获取 API 密钥
上下文

各模型的上下文窗口

引擎从目录中读取真实窗口, 并且绝不允许您要求更多。 默认值为20万, 不论模式允许什么 。

read from the cataloguecached 10 minutescontext_too_large
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

如何决定限额

  • 模型窗口从 (目录) 开始跑步 保持十分钟
  • 无 contextTokens,限制是 小 和那扇窗户
  • 与 contextTokens这就是极限——除非它大于被拒的窗口。
// Default on a model with a 1 048 576-token window → limit 200 000
api.agents.create({ runtime: "local", machine: pc, model: "gemini-3.5-flash" });

// Asking for more than the model has
api.agents.create({ runtime: "local", machine: pc, model, contextTokens: 2_000_000 });
// IaGenifyError context_too_large: contextTokens (2,000,000) is larger than
// the context window of … (1,048,576 tokens).
from iagenify import IaGenifyError

# Default on a model with a 1 048 576-token window → limit 200 000
api.agents.create(runtime="local", machine=pc, model="gemini-3.5-flash")

# Asking for more than the model has: refused on the first run, once the window is read
agent = api.agents.create(runtime="local", machine=pc, model=model, context_tokens=2_000_000)
try:
    agent.run(message="…")
except IaGenifyError as error:
    print(error.code)   # "context_too_large"

接受接受的

contextTokensinteger200 000

几件全记号 至少 10 000 个以上。其他任何拒绝的 invalid_context 创建时。

目录是在运行时阅读的, 不是创建时, 所以 context_too_large 第一个 run() 而不是当天体被建造时。

为什么默认值低于窗口

窗口是适合的,不是明智的

运送80万个物证的转弯速度缓慢,费用昂贵,因为整个历史每次重现。 200 000是一个工作上限,可以快速地前进;提高这个上限是您为具体工作所做的决定,而不是您继承的违约。

读回读回

agent.context;
// { tokens: 31_204, limit: 200_000, window: 1_048_576, cachedTokens: 22_400,
//   cleared: 3, parts: { system: 2_100, tools: 3_900, memory: 180, messages: 25_024 } }
agent.context
# {"tokens": 31_204, "limit": 200_000, "window": 1_048_576, "cachedTokens": 0,
#  "cleared": 3, "parts": {"system": 2_100, "tools": 3_900, "memory": 0, "messages": 25_204}}
字段是
tokens由提供者测量的最后一个转弯的大小 。
limit有效限度——你的 contextTokens,或违约。
window模型的窗口是自己的,或者 null 如果目录无法读取 。
cachedTokens供应商上次从缓存中 提供多少服务
cleared迄今为止,已清空了多少工具结果。
parts解析:系统、工具、内存、信息。

如果目录无法读取

运行以您要求的上限或默认值继续 。 window 居留 null 也没有任何人因为太大而被拒绝,

当您调出后退模式时要注意

限制从主模式中解析。 小窗口的回退可以拒绝一个被接受的主要历史, 从而选择大小相当的回退, 或者保留 contextTokens 以他们所持的价位计。