电话费多少?
const result = await assistant.generate({ inputs });
result.usage;
// { credits: 4, inputTokens: 38, outputTokens: 96 }
const turn = await api.models.turn({ model, messages });
turn.usage;
// { credits: 3, inputTokens: 1840, outputTokens: 77, thinkingTokens: 54 }
await agent.run({ message });
agent.usage;
// { credits, turns, toolCalls } — the whole run, tools includedresult = assistant.generate(inputs=inputs)
result["usage"]
# {"credits": 4, "inputTokens": 38, "outputTokens": 96}
turn = api.models.turn(model=model, messages=messages)
turn["usage"]
# {"credits": 3, "inputTokens": 1840, "outputTokens": 77, "thinkingTokens": 54}
agent.run(message=message)
agent.usage
# {"credits", "turns", "toolCalls"} — the whole run, tools included你不要把这些加起来
代理运行已经计算了它支付的工具。 在运行总额之上添加工具的信用额, 共计算了两次 。
读读价格
价格来自服务器。 复制到您的代码中是显示的 费用从充电的流出 。
const prices = await api.catalogue();
// [{ model, service, provider, unit, credits,
// creditsInput, creditsOutput, // when billed per token
// contextWindow, maxOutput, // text models
// cachedInputRate, // what a cached input token costs
// resolution, audio, // media variants
// deprecatedAfter }]
const row = prices.find((p) => p.model === "gemini-3.5-flash" && p.service === "text-to-text");prices = api.catalogue()
# [{"model", "service", "provider", "unit", "credits",
# "creditsInput", "creditsOutput", # when billed per token
# "contextWindow", "maxOutput", # text models
# "cachedInputRate", # what a cached input token costs
# "resolution", "audio", # media variants
# "deprecatedAfter"}]
row = next(p for p in prices if p["model"] == "gemini-3.5-flash" and p["service"] == "text-to-text")单位 命令您如何读取分数
| 单位单位 | 由 |
|---|---|
| 1M 象征性牌 | 单行、内、外的等、面和外的等等等,读入数 投入和信用 |
| 第二次 | 持续时间——录像 |
| 1K 字符 | 输入长度——演讲 |
| 图像图像图像图像 | 每图象一一, 分辨率变化 |
| 任何其他内容 | 固定电话费 |
余额余额
const { credits, pack } = await api.getUser();user = api.get_user()
credits, pack = user["credits"], user["pack"]代理商可以用它自己 account 工具是免费的,成本是免费的,不考虑问题——值得允许,所以它检查而不是猜测。
正在流出
工作开始前拒绝要求支付余额,不收取任何费用。
try {
await assistant.generate({ inputs });
} catch (err) {
if (err instanceof NotEnoughCredits) {
console.log(`needs ${err.required}, has ${err.available}`);
}
}try:
assistant.generate(inputs=inputs)
except NotEnoughCredits as error:
print(f"needs {error.required}, has {error.available}")绕着跑跑能花多少
代理决定它要采取多少步骤, 所以唯一真正约束的就是预算。 它在工具运行之前, 而不是之后检查 。
const agent = api.agents.create({
runtime: "local",
machine: pc,
model: "gemini-3.5-flash",
budget: 200, // credits for this run
maxSteps: 40, // and a ceiling on turns
});agent = api.agents.create(
runtime="local",
machine=pc,
model="gemini-3.5-flash",
budget=200, # credits for this run
max_steps=40, # and a ceiling on turns
)