Skip to main content

MaaS API

openaianthropicgoogle
parallel_tool_callsdisable_parallel_tool_use
max_completion_tokensmax_tokens
  • “长尾分布”
  • “突发性”
  • "Fat Tail" (肥尾)
  • 3+Sigma + 15-30min 窗口检查异动

Gemini API

Multiple tools are supported only when they are all search tools

  • 内置 tool 和 functionDeclaration 工具不能同时使用
  • openai 里的 tool 映射为一个 functionDeclaration
  • 其他的 tool 是内置 tool,语义上有点区别

OpenAI API

streaming

first chunk

  • 有些为了紧凑,会在第一个 chunk 包含内容
  • 正常情况第一个 chunk 不应该包含内容

last chunk

  • vLLM, OpenAI 最后一个 chunk 的 content 为 空
{
"index": 0,
"delta": {
"content": ""
},
"logprobs": null,
"finish_reason": "stop",
"stop_reason": null
}

ToolChoice

  • auto
    • 自动选择工具
  • required
    • 必须使用工具
  • none
    • 不使用工具

Thinking

{
"contents": [
{
"parts": [
{
"text": "Provide a list of 3 famous physicists and their key contributions"
}
]
}
],
"generationConfig": {
"thinkingConfig": {
"thinkingLevel": "low"
}
}
}

Interleaved thinking

思考过程可以进行 tool call

  • Claude 4+
    • interleaved-thinking-2025-05-14
    • Messages API 才支持
  • MiniMax-M2
  • Kimi-K2-Thinking

reasoning_details

{
"type": "reasoning.summary",
"summary": "The model analyzed the problem by first identifying key constraints, then evaluating possible solutions...",
"id": "reasoning-summary-1",
"format": "anthropic-claude-v1",
"index": 0
}
  • type
    • reasoning.summary
    • reasoning.encrypted
    • reasoning.text
  • 维护思考细节信息
    • OpenAI o
    • Claude 3.7+ thinking
    • Gemini Reasoning
    • xAI Reasoning

Preserved thinking


role

  • developer
  • system
  • user
  • assistant
  • tool
    • 新版本 openai
    • Anthropic 使用 user role
  • function
    • 旧版本 openai

Gemini

Missing thought_signature in function call

Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.

usage

  • 付费
    • 算力
    • pay per token
    • pay per request
    • pay per item
      • 图、语音

abort

  • stream 499 会产生费用
  • 非strema 中断也会产生费用
    • 极端情况会产生完整的费用
  • Agent 实现在中断时候需要预估 usage
    • 否则 context window 会失准

Prompt Cache

模型 / 场景最小缓存 Token 数
Claude Opus 4.54096
Claude Opus 4.1, 41024
Claude Sonnet 4.5, 4, 3.71024
Claude Haiku 4.54096
Claude Haiku 3.5, 32048
Gemini 3 Pro Preview4096
Gemini 3 Flash Preview1024
Gemini 2.5 Pro4096
Gemini 2.5 Flash1024
Gemini Explicit Caching (Vertex AI)4096
Gemini Context Caching (Early Versions)32768
OpenAI GPT1024
  • Implicit Caching: 提供 75% - 90% 的输入 Token 折扣。
  • Explicit Caching: 按生存时间 (TTL) 收取存储费用。
  • 容量: 最大缓存大小等同于模型完整上下文窗口(可超过 100 万 Token)。
  • Gemini 3 优化: 在 Gemini 3 系列中,建议 Prompt 前缀或缓存数据至少达到 4096 Token 以确保缓存生效并有效降低 API 成本。
  • Google OpenAI API extra body
{
"google": {
"cached_content": "cachedContents/XXX",
"thinking_config": {
"thinking_level": "low",
"include_thoughts": true
}
}
}

FAQ

role developer vs system

  • OpenAI o1-2024-12-17 之后推出的
  • developer 权重比 system 高
  • developer
    • 强调规则
  • system
    • 强调角色

Unable to submit request because thinking_budget and thinking_level are not supported together

Gemini 限制

Claude temperature, top_p 不能一起传

AI_APICallError: Error while downloading [URL REDACTED].

openai 相关似乎不允许 wikimedia 来源图片

Output Speed

参考TPS
朗读/听书3-4
正常默读5-10
快速略读15 - 25
ModelTPS
Claude Sonnet 4.540
gemini-3-flash-preview80-100
级别TPS典型应用场景
超快 (Instant)800 - 1200实时语音助手、搜索建议
快速 (Fast)150 - 250简单翻译、摘要、简单对话
标准 (Standard)70 - 100复杂指令、代码生成、字幕
重型 (Heavy)20 - 50深度写作、复杂逻辑推理
  • Prefill Speed
    • 一般 > 2000t/s
    • Context Caching 加速 Prefill
  • TPS / Token Per Seconds
  • 思考影响速度
    • 思考 budget 影响思考深度