NOV. 3, 2026号
Per-token API价格持续下跌,然而自主编码agents的工程账单却不断攀升。 每百万金币的价格不再是生产经济学的衡量标准了现在,主要衡量标准是每个成功任务的成本:每个循环循环、工具呼叫、重试和内部思维通过的总开支除以通过核查的任务数量。
当agent称它拥有每一个微量判断的高度思维推理配置时,你正在支付一个轻量级配置已经准确回答的问题的深理价格。 为防止这种不必要的管理费,考虑增加一个轻量级的路由层,可以在常规决定达到昂贵的推理模型之前拦截这些决定。
这就是在Google抗重力模式调用前接线TypeSafe的Jev分类器的前提。 Jev——一个为高通量决策管道设计的专业化结构化输出分类器——不是以代号生成文本符号,而是在单个前传中评价结构化的分类原始:从列表中选择,数字分数或努尔,它返回一个二进制语句的0比1概率。
为全面披露,Google与TypeSafe没有合作关系,本条不是TypeSafe或其产品的背书。 Jev在这里被用作轻量级分类器的一个例子,同样的路由模式可以与其他分类器一起构建,包括Google-native. 例如,"Getting"以歧视模型编码板开始,在DifmusionGemma,Google DeepMind's 开放权重模型上运行同样种类的分类器,在您自己的Google云项目中运行。
我们运行了50个问题,自动分级,编码-agent 基准测试对阵直播的Gemini和Jev API,以测试一个接近免费的分类器是否能够将每个任务引导到仍然获得正确性的最便宜的模型。 这就是我们学到的:
要求Jev路由编码任务的天真方式是一个单一的广义选择问题:简单或复杂。 当我们在16项编码-agent任务上首先测试时,Jev将几乎所有的路由都推向简单,甚至任务需要LRU缓存跟踪或模块化指示。 TypeSafe的文档警告与这个精确的反模式。 如果一个问题权衡多个因素或需要meta判断,则将其分解为原子检查。
当我们用一个原子诺尔问题来取代广义的选择问题时,它立即确定了分离。 问题是:在回答这个问题时,是否要求进行不止一次顺序计算,模拟步骤或逻辑推理,而不是一次直接检查,格式检查或一步分类?
调用 jev( 问题 text):
车身={
“状态”:问题文本
"模型":"jev-latest" (英语).
"问题":{
"多步骤":{
"类型":"努尔"
"训导":(......
"回答这需要完成不止一个"
"顺序计算,模拟步骤,或逻辑"
"介绍,而不是单一的直接检查,格式"
"检查,或单步分类".
),
}
},
}
# 将上面的请求发送到分类者的API.
# response.answers ["multi step"]. 努尔是用于路由的概率。
Python
复制
在这些最初的16项任务上,捷夫在第一次比赛中同意了16项中的13项,在第二次比赛中同意了我们的手贴难度,16项中的14项。 许多工程团队询问,当他们可以在Python中写出零成本的regex和即时长的heuristic,匹配序列,modulo和种族条件等单词时,他们是否甚至需要一个分类器API,或者任何超过35个单词的即时升级。
在16个用来写这些确切规则的发展问题上,当地heuristic在16分中得分15分,即93.8%. 为了测试Heuristic是否在现实的编码-agent流量中幸存下来,我们冻结了它的代码而不改变一个字符,并在7个编码-agent桶中增加了34个隐形的被搁置的任务:事实提取,计划验证,短分类,单跳代码检查,状态模拟痕迹,数学或逻辑链和微妙的语言语义错误。
关于34个搁置的问题,冻结的heuristic下降了23.2%,达到70.6%. 从 Kubernetes YAML 运单中提取一个端口,从一个统一的 git diff 头或从一个 Python 溯源中提取一个行号的文件路径等现实化的简单任务超过了35字,并引发了虚假的升级。 反之,简洁的多步代码痕迹,如可变的默认参数横跨呼叫,Python字典键在{1}上的散列:"a",True:"b",1.0:"c")和C短路评价缺乏heuristic的硬编码的拼图词,被错误地引导到简单的路径。 Jev将所有34项隐蔽任务分类为100.0%的协议,34项中的34项达到50项中的48项,即96.0%。
在建立快速路径路由器时的一个常见错误是假设在推理模型上设置一个低最大输出点(maxOutputTokens)上限会使其在轻松的任务上花费更少。 我们50个问题的数据显示为什么这个假设失败了
当我们将gemini-3.8-闪电与最大输出Tokens=300对gemini-3.8-闪电与最大输出Tokens=4096进行对比时,同时将思维Config留在API默认时,两个配置在Jev标注的SIMPLE的27项任务上花费了几乎相同的思维符:
注:数字反映抽样测试套件上单运行的实验测量结果;实际延迟、象征性计数和计费费用将根据快速长度、上下文缓存和生产负荷而有所不同。
将模型的输出卡在300个符牌上,并没有为轻松的任务节省任何资金。 盖子只是天花板,简单的答案从未接近它。 在简单的任务上,封装版本实际上比未封装版本的成本略高。 25项硬任务中只有7项被打破了在其中6架上,模型在仍然推理的同时跑出房间,从未给出答案。 第七,它挤压其推理以适应,按时完成并得到了错误的答案。
所以一个Jev路由器向盖盖的模型发送简单的任务,向普通的Flash发送硬任务,得到了全部50个正确。 其成本仍然略高于跳过路由器并使用普通的Flash来做一切,而且速度也比较慢。 如果你的廉价选择并没有真正使模型思考较少对于容易的任务,没有路由器可以节省你的钱。 即使是一个完美而毫无代价的
少花钱思考的明显方式是要求模型少思考。 于是我们用两个更轻的选项进行了第二轮测试:Flash-Lite,它根本不默认思考,和Gemini 3.8 Flash,它的思维水平设定为低。 我们把这些结果添加到同一个结果文件中,逐个问题地对应。
关于时间的说明。 路由器每个任务的大部分时间都用在Flash-Lite和Flash的调用上,我们用与Plain Flash基线相同的运行和时间窗口测量,因此它们之间的速度比较是公平的。 捷夫自己的决定权在总数中只占很小的份额,来自于第一轮。 与默认的 Flash 或 Pro 进行速度比较,将两回合混合,所以读取为近似。
7-bucket破解显示其中gemini-3.5-flash-lite和heuristic路由器错过了任务以及路由器Jev:闪光-Lite到3.8 Low如何恢复100%的精度:
没有路由器的最强设置是低思维的Gemini 3.8 Flash. 它解决了所有50项任务。 这是路由器必须打的号码。
捷夫路由器击败了它。 它将每一项任务先送到Flash-Lite,只升级Jev旗的复杂内容。 它也解决了所有50项任务,它能帮助减少成本和反应时间,而减少对一切的低思考。 在提示时,每个任务的成本差异是小的,所以对于交互式的agent,更短的等待是更大的好处。
为什么它工作。 Flash-Lite自己在半秒内回答了每一个简单的任务,但错过了25个硬任务中的6个。 Jev以高度的自信将所有6个都标注为复杂,并将其升级。 这使得它的成本接近一个完美的路由器能够实现的目标。
关键词热度比较低廉但只是因为它弄错了它向Flash-Lite发送了5项硬任务,其中2项失败,为50项中的48项。
升级到一个更重的场景在这里没有支付。 在默认思维上向 Flash 运行困难任务比在任何地方运行默认思维便宜。 这比对一切低沉的思考还要贵已经解决了所有50个更严重的升级目标只有在低位设定开始失败时才有意义。
限制:每个设置运行一次,50个有手分配难度的提示和简单的自动分级。
我们的两件事只有在你过去的时候才会出现
绕道和夹道向相反方向拉动。 我们的测试提示是短的,独立的任务,在那些Jev路由器上帮助减少了成本和反应时间。 真正的编码agents经常看起来不同。 它们在每个回合发送相同的大块上下文,例如寄存器和工具定义的地图。 Agent 平台背景停车商店,所以你支付75%到90% 来重新发送它。 捕捉到的是缓存属于一个模型。 如果您的 agent 在 Flash-Lite 和 Flash 之间切换,它要么保持两个缓存,要么失去折扣。 实际划分:路由短,自成一体的任务,如日志解析或计划检查,并保持长长,上下文重的转向在一个模型上。
将模型与工作量匹配。 Gemini 3.1 请检查date=中的日期值 (帮助) Pro是为深度,多步推理而构建的,它带来与每个请求的深度相同,包括不需要的短视。 对于大部分由快速检查和提取而来的工作量来说,Flash配置更合适,Pro被最好地用于需要其推理深度的任务。 模型配置还可以将不同的安全设置应用于与安全相关的提示。 在我们的运行中,Pro配置拒绝了两个简短的代码安全审查提示Flash回答。 如果您的 agent 执行安全审查,测试这些提示您计划使用的配置。
其他建造路由器的方法。 Jev是获得快速分类器的一种方法,但不是唯一的方法。 "Getting"以歧视性模型编码板开始,在DifmusionGemma,Google DeepMind's 开放权重模型上运行相同的Choice,Score和Noul问题,托管于一个计算引擎GPU VM上或在你自己的Google Cloud项目上的Cloud Run上。 开源服务器在它前面暴露出相同的API,因此本条中的路由码只需要不同的端点。 我们的成绩来自Jev,所以在切换前要测量自己的任务的准确性和耐久性,并记住自办的模型由GPU时数而不是符号计费。
总之,结果提供了三项实际规则。
在建立路由器之前先从低沉思维开始。 它解决了所有50项任务,成本大大低于默认设置。 降低输出符号限制不是替代物,因为它不会减少模型对简单任务所认为的多少。 直接设置思维级别,并设置思维级别:"LOW".
使用Jev来路由短路,独立的任务。 向 Flash-Lite 发送简单的任务,向 Flash 发送低思考的硬任务。 问Jev一个简单的是或不是问题每个因素。 在我们的测试中,这帮助减少了成本和反应时间与运行Flash相比,低思考的一切,并接近一个完美的路由器将实现的。 保持长,上下文重的打开一个单一的模型,所以缓冲继续工作。 对于大量仓库工作量,杰夫·尼尔森的"大查询"(BigQuery)和"云奔"(Cloud Run)的级联模式也应用了同样的想法。
量量你的agent实际花费多少。 将您的 agent 的踪迹和思维计数发送给 Cloud Looking 和 BigQuery,这样您就可以看到哪些任务驱动您的开支,并捕捉短音或重音使其充气。 基准测试代码将在开源审查后公布。
简而言之,运行agent最符合成本效益的方法是将每项任务与适合它的模式相匹配。 从灯光设定上的快速模型开始。 你经常会发现它已经完成了工作。 然后添加一个小的,几乎自由的分类器,如Jev,只将困难的任务发送到更强的模型,并询问简单的y
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
NOV. 3, 2026
Per-token API prices keep falling, yet engineering bills for autonomous coding agents keep climbing. Price per million tokens isn't the metric that actually governs production economics anymore. The dominating metric is now cost per successful task: total spend across every loop iteration, tool call, retry and internal thinking pass divided by the number of tasks that pass verification.
When an agent calls a high-thinking reasoning configuration for every micro-decision in its harness, you're paying deep-reasoning prices for questions a lightweight configuration already answers accurately. To prevent this unnecessary overhead, consider adding a lightweight routing layer that can intercept routine decisions before they ever reach an expensive reasoning model.
That is the premise behind wiring TypeSafe's Jev classifier in front of Google Antigravity's model calls. Rather than generating text token by token, Jev—a specialized structured-output classifier designed for high-throughput decision pipelines—evaluates structured classification primitives in a single forward pass: a Choice from a list, a numeric Score or a Noul, which returns a 0 to 1 probability for a binary statement.
For full disclosure, Google has no partnership with TypeSafe, and this article is not an endorsement of TypeSafe or its products. Jev is used here as one example of a lightweight classifier, and the same routing pattern can be built with other classifiers, including Google-native ones. The Getting started with discriminative models codelab, for example, runs the same kind of classifier on DiffusionGemma, Google DeepMind's open-weights model, in your own Google Cloud project.
We ran a 50-question, auto-graded, coding-agent benchmark against live Gemini and Jev APIs to test whether a near-free classifier can route each task to the cheapest model that still gets it right. Here's what we learned:
The naive way to ask Jev to route a coding task is a single broad Choice question: simple or complex. When we tested that first on 16 coding-agent tasks, Jev routed nearly everything to simple, even tasks requiring an LRU cache trace or modular exponentiation. TypeSafe's documentation warns against this exact anti-pattern. If a question weighs multiple factors or requires a meta-judgment, decompose it into an atomic check.
When we replaced the broad Choice question with one atomic Noul question, it fixed the separation immediately. The question was: does answering this require performing more than one sequential calculation, simulation step or logical deduction, rather than a single direct lookup, format check or one-step classification?
def call_jev(question_text):
body = {
"state": question_text,
"model": "jev-latest",
"questions": {
"multi_step": {
"type": "noul",
"instructions": (
"Answering this requires performing more than one "
"sequential calculation, simulation step, or logical "
"deduction, rather than a single direct lookup, format "
"check, or one-step classification."
),
}
},
}
# Send the request above to the classifier's API.
# response.answers["multi_step"].noul is the probability used to route.
Python
Copied
On those initial 16 tasks, Jev routed 13 of 16 in agreement with our hand-labeled difficulty on the first run and 14 of 16 on the second pass. Many engineering teams ask whether they even need a classifier API when they can write a zero-cost regex and prompt-length heuristic in Python, matching words like sequence, modulo and race condition or escalating any prompt over 35 words.
On the 16 development questions used to write those exact rules, the local heuristic scored 15 of 16, or 93.8%. To test whether that heuristic survived contact with realistic coding-agent traffic, we froze its code without changing a character and added 34 unseen held-out tasks across seven coding-agent buckets: fact extraction, schema validation, short classification, single-hop code checks, state simulation traces, math or logic chains and subtle language-semantics bugs.
On the 34 held-out questions, the frozen heuristic dropped 23.2 percentage points to 70.6%. Realistic simple tasks such as extracting a port from a Kubernetes YAML manifest, a file path from a unified git diff header or a line number from a Python traceback exceeded 35 words and triggered false escalations. Conversely, concise multi-step code traces such as mutable default arguments across calls, Python dictionary key hashing on {1: "a", True: "b", 1.0: "c"} and C short-circuit evaluation lacked the heuristic's hardcoded puzzle words and were falsely routed to the simple path. Jev classified all 34 unseen tasks with 100.0% agreement, 34 of 34, reaching 48 of 50, or 96.0%, across the full suite.
A common mistake when building a fast-path router is assuming that setting a low maxOutputTokens cap on a reasoning model will make it spend less on easy tasks. Our 50-question data shows why that assumption fails.
When we compared gemini-3.8-flash with maxOutputTokens=300 against gemini-3.8-flash with maxOutputTokens=4096 while leaving thinkingConfig at the API default, both configurations spent almost identical thinking tokens on the 27 tasks Jev labeled SIMPLE:
Note: Figures reflect single-run experimental measurements on a sample test suite; actual latencies, token counts, and billed costs will vary based on prompt length, context caching, and production load.
Capping the model's output at 300 tokens didn't save any money on easy tasks. The cap is only a ceiling, and easy answers never came close to it. On the easy tasks, the capped version actually cost slightly more than the uncapped one. All the cap did was break 7 of the 25 hard tasks. On six of them, the model ran out of room while still reasoning and never gave an answer. On the seventh, it squeezed its reasoning to fit, finished on time and got the answer wrong.
So a Jev router that sends easy tasks to the capped model and hard ones to normal Flash got all 50 right. It still cost slightly more than skipping the router and using normal Flash for everything, and it was slower. If your cheap option doesn't actually make the model think less on easy tasks, no router can save you money. Not even a perfect one that costs nothing.
The obvious way to spend less on thinking is to ask the model to think less. So we ran a second round of tests with two lighter options: Flash-Lite, which doesn't think at all by default, and Gemini 3.8 Flash with its thinking level set to low. We added those results to the same results file, matched question by question.
A note on timing. Most of the router's time per task is spent in Flash-Lite and Flash calls, which we measured in the same run and time window as the plain Flash baseline, so the speed comparison between them is fair. Jev's own decision is a small share of the total and comes from the first round. Speed comparisons against default Flash or Pro mix the two rounds, so read those as approximate.
The 7-bucket breakdown shows where gemini-3.5-flash-lite and the heuristic router missed tasks and how Router Jev: Flash-Lite to 3.8 LOW recovered 100% accuracy:
The strongest setup without a router was Gemini 3.8 Flash on low thinking. It solved all 50 tasks. That's the number a router had to beat.
The Jev router beat it. It sends every task to Flash-Lite first and escalates only what Jev flags as complex. It also solved all 50 tasks, and it can help reduce both cost and response time compared with running low thinking on everything. On prompts this short the cost difference per task is small, so for an interactive agent the shorter wait is the bigger benefit.
Why it works. On its own, Flash-Lite answered every simple task in half a second but missed 6 of the 25 hard ones. Jev flagged all 6 as complex with high confidence and escalated them. That brought its cost close to what a perfect router would achieve.
The keyword heuristic was cheaper, but only because it got things wrong. It sent 5 hard tasks to Flash-Lite, and 2 of them failed, for 48 of 50.
Escalating to a heavier setting didn't pay here. Routing hard tasks to Flash on default thinking was cheaper than running default thinking everywhere. It still cost more than running low thinking on everything, which already solved all 50. A heavier escalation target only makes sense when the low setting starts failing.
Limits: one run per setup, 50 prompts with hand-assigned difficulty and simple automatic grading.
Two things in our results only show up once you look past it.
Routing and caching pull in opposite directions. Our test prompts were short, standalone tasks, and on those the Jev router helped reduce both cost and response time. Real coding agents often look different. They send the same big block of context on every turn, such as a map of the repository and the tool definitions. Agent Platform Context Caching stores that block so you pay 75% to 90% less to resend it. The catch is that a cache belongs to one model. If your agent switches between Flash-Lite and Flash from turn to turn, it either keeps two caches or loses the discount. The practical split: route short, self-contained tasks like log parsing or schema checks, and keep long, context-heavy turns on one model.
Match the model to the workload. Gemini 3.1 Pro is built for deep, multi-step reasoning, and it brings that same depth to every request, including short lookups that don't need it. For a workload made mostly of quick checks and extractions, a Flash configuration is the better fit, and Pro is best saved for the tasks that need its reasoning depth. Model configurations can also apply different safety settings to security-related prompts. In our run, the Pro configuration declined two short code-security review prompts that Flash answered. If your agent performs security reviews, test those prompts on the configuration you plan to use.
Other ways to build the router. Jev is one way to get a fast classifier, but not the only one. The Getting started with discriminative models codelab runs the same Choice, Score and Noul questions on DiffusionGemma, Google DeepMind's open-weights model, hosted on a Compute Engine GPU VM or on Cloud Run in your own Google Cloud project. An open-source server exposes the same API in front of it, so the routing code in this article only needs a different endpoint. Our results come from Jev, so measure accuracy and latency on your own tasks before switching, and keep in mind that a self-hosted model is billed by the GPU-hour rather than by the token.
Taken together, the results give three practical rules.
Start with Flash on low thinking before you build a router. It solved all 50 tasks and cost considerably less than the default setting. Lowering the output token limit is not a substitute, because it doesn't reduce how much the model thinks on easy tasks. Set the thinking level directly, with thinkingLevel: "LOW".
Use Jev to route short, standalone tasks. Send simple tasks to Flash-Lite and hard ones to Flash on low thinking. Ask Jev one simple yes-or-no question per factor. In our test, this helped reduce cost and response time compared with running Flash on low thinking for everything, and came close to what a perfect router would achieve. Keep long, context-heavy turns on a single model so caching keeps working. For high-volume warehouse workloads, Jeff Nelson's BigQuery and Cloud Run cascade pattern applies the same idea.
Measure what your agent actually spends. Send your agent's traces and thinking-token counts to Cloud Logging and BigQuery, so you can see which tasks drive your spend and catch truncation or retries that inflate it. The benchmark code will be published after open-source review.
In summary, the most cost-effective way to run an agent is to match each task to the model that fits it. Start with a fast model on a light setting. You'll often find it already gets the job done. Then add a small, almost free classifier like Jev to send only the hard tasks to a stronger model, and ask simple y
Auto-fetched and translated by AI Atlas. All rights belong to the original author.