跳转至

MaaS_Cl_opus_4.5/4.6/4.7

1. Effort

使用努力程度参数控制 Claude 在响应时使用多少令牌,在响应完整性和令牌效率之间进行权衡。

努力程度参数允许您控制 Claude 在响应请求时花费令牌的积极程度。这使您能够在响应完整性和令牌效率之间进行权衡,所有这一切都可以通过单个模型实现。

  1. effort 参数已在所有支持的模型上正式可用,无需 beta 头

  2. 目前支持模型:effort 参数由 Claude Opus 4.6 和 Claude Opus 4.5 支持

  3. max参数只有模型 Claude Opus 4.6支持

  4. 新增effort等级 :claude opus 4.7 支持 xhigh,并且默认设置为high

级别 描述 典型用例
high 最大完整性 ——Claude 使用尽可能多的令牌。等同于不设置该参数。 复杂分析、详细解释、教育内容
medium 平衡的方法,具有适度的令牌节省。 大多数生产用例、成本意识应用
low 最高效的令牌响应。 高容量自动化、简单查询、当响应以编程方式处理时
max 绝对最高能力,对 token 消耗没有限制。仅限 Opus 4.6在其他模型上使用 max 的请求将返回错误。 需要最深层推理和最全面分析的任务
xhigh 极高完整性模式 —— 在保持合理成本与延迟的前提下,提供接近 max 级别的输出深度与细节。比 high 使用更多令牌,但不会达到无限制程度。 深度研究、长篇报告生成、复杂代码编写、需要高细节但非绝对无上限的极端任务

原生接口(/v1/messages)

curl --location --request POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
--header 'Authorization: Bearer ${your AK}' \
--header 'anthropic-beta: effort-2025-11-24' \
--header 'Content-Type: application/json' \
--data-raw '{
        "model": "claude-opus-4-5-20251101",
        "max_tokens": 4096,
        "messages": [{
            "role": "user",
            "content": "接下来是什么:2, 6, 12, 20, 30, ?"
        }],
        "output_config": {
            "effort": "high"
        }
    }'

原生接口(/v2)

curl --location --request POST 'https://genaiapi.cloudsway.net/v2/ai/xxxxx/claude/chat/completions' \
--header 'Authorization: Bearer ${your AK}' \
--header 'anthropic-beta: effort-2025-11-24' \
--header 'Content-Type: application/json' \
--data-raw '{
        "model": "claude-opus-4-5-20251101",
        "max_tokens": 4096,
        "messages": [{
            "role": "user",
            "content": "接下来是什么:2, 6, 12, 20, 30, ?"
        }],
        "output_config": {
            "effort": "high"
        }
    }'

openAI兼容接口(chat/completion)

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/chat/completions' \
--header 'Authorization: Bearer ${your AK}' \
--header 'anthropic-beta: effort-2025-11-24' \
--header 'Content-Type: application/json' \
--data-raw '{
        "model": "claude-opus-4-5-20251101",
        "max_tokens": 4096,
        "messages": [{
            "role": "user",
            "content": "接下来是什么:2, 6, 12, 20, 30, ?"
        }],
        "output_config": {
            "effort": "high"
        }
    }'

2. output_format

用于结构化输出output_format 参数已移至 output_config.format

原生接口(/v1/messages)

curl --location --request POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
--header 'Authorization: Bearer ${your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Extract the key information from this email: John Smith (john@example.com) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm."
    }
  ],
  "output_config": {
    "format": {
      "type": "json_schema",
      "schema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "plan_interest": {
            "type": "string"
          },
          "demo_requested": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "email",
          "plan_interest",
          "demo_requested"
        ],
        "additionalProperties": false
      }
    }
  }
}'

原生接口(/v2)

curl --location --request POST 'https://genaiapi.cloudsway.net/v2/ai/{endpoint}/claude/chat/completions' \
--header 'Authorization: Bearer ${your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Extract the key information from this email: John Smith (john@example.com) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm."
    }
  ],
  "output_config": {
    "format": {
      "type": "json_schema",
      "schema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "plan_interest": {
            "type": "string"
          },
          "demo_requested": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "email",
          "plan_interest",
          "demo_requested"
        ],
        "additionalProperties": false
      }
    }
  }
}'

openAI兼容接口(chat/completion)

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/chat/completions' \
--header 'Authorization: Bearer ${your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "messages": [
        {
            "role": "user",
            "content": "Extract the key information from this email: John Smith (john@example.com) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm."
        }
    ],
    "stream": false,
    "stream_options": {
        "include_usage": true
    },
    "response_format": {
        "type": "json_schema",
        "json_schema": {
            "name": "calculus_solution",
            "schema": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "plan_interest": {
                        "type": "string"
                    },
                    "demo_requested": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "name",
                    "email",
                    "plan_interest",
                    "demo_requested"
                ],
                "additionalProperties": false
            },
            "strict": true
        }
    }
}'

3. Adaptive thinking

模型 Opus 4.5 Opus 4.6 Sonnet 4.5 Sonnet 4.6 Opus 4.7
开关思考+budget_tokens 弃用,后续移除
能否输出思考内容 弃用,后续移除
是否支持Adaptive thinking × ×
支持的思考级别effort high、medium、low max、high、medium、low high、medium、low high、medium、low xhigh、max、high、medium、low
强制控制 × × ×
  1. 自适应思考还会自动启用交错思考。

  2. thinking: {type: "enabled"}budget_tokens 在 Opus 4.6 上已弃用。它们仍然可以使用,但将在未来的模型版本中移除。请改用自适应思考和努力参数来控制思考深度。

  3. Adaptive thinking的参数使用

在 Claude Opus 4.7 中,自适应思考默认是关闭的。未包含思考字段(thinking field)的请求将在不进行思考的情况下运行。如需启用该功能,请显式设置 thinking: { type: "adaptive" }

"thinking": {
    "type": "adaptive"
},
"output_config":{
    "effort": "max",
    "format": {}    //结构化输出
}

旧的思考程度控制方法

    "thinking": {
        "type": "enabled",
        "budget_tokens": 10000
    }

4. Tool search tool

  1. 需要添加header:tool-search-tool-2025-10-19

  2. type是:tool_search_tool_regex,不支持type:tool_search_tool_bm25_20251119

  3. openai格式的暂不支持

请求示例

curl --location --request POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
--header 'Authorization: Bearer ${your AK}' \
--header 'anthropic-beta: effort-2025-11-24,tool-search-tool-2025-10-19' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "claude-opus-4-5-20251101",
    "max_tokens": 4096,
    "messages": [
        {
            "role": "user",
            "content": "What is the weather in San Francisco?"
        }
    ],
    "output_config": {
        "effort": "medium"
    },
    "tools": [
        {
            "type": "tool_search_tool_regex",
            "name": "tool_search_tool_regex"
        },
        {
            "name": "get_weather",
            "description": "Get the weather at a specific location",
            "input_schema": {
                "type": "object",
                "properties": {
                    "location": {
                        "type": "string"
                    },
                    "unit": {
                        "type": "string",
                        "enum": [
                            "celsius",
                            "fahrenheit"
                        ]
                    }
                },
                "required": [
                    "location"
                ]
            },
            "defer_loading": true
        },
        {
            "name": "search_files",
            "description": "Search through files in the workspace",
            "input_schema": {
                "type": "object",
                "properties": {
                    "query": {
                        "type": "string"
                    },
                    "file_types": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "query"
                ]
            },
            "defer_loading": true
        }
    ]
}'

5. 支持1M上下文

规格 Claude Opus 4.5 Claude Opus 4.6 Claude Opus 4.7
上下文窗口 200K tokens 200K tokens (1M tokens 为Beta版) 1M tokens
最大输出 token 64K tokens 128K tokens 128K tokens

原生接口(/v1/messages)

curl --location --request POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
--header 'Authorization: Bearer ${your AK}' \
--header 'anthropic-beta: context-1m-2025-08-07' \
--header 'Content-Type: application/json' \
--data-raw '{
  "max_tokens": 1024,
  "messages": [
        {
            "role": "user",
            "content": "长文本-------"
        }
    ]
}'

原生接口(/v2)

curl --location --request POST 'https://genaiapi.cloudsway.net/v2/ai/{endpoint}/claude/chat/completions' \
--header 'Authorization: Bearer ${your AK}' \
--header 'anthropic-beta: context-1m-2025-08-07' \
--header 'Content-Type: application/json' \
--data-raw '{
  "max_tokens": 1024,
  "messages": [
        {
            "role": "user",
            "content": "长文本-------"
        }
    ]
}'

openAI兼容接口(chat/completion)

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/chat/completions' \
--header 'Authorization: Bearer ${your AK}' \
--header 'anthropic-beta: context-1m-2025-08-07' \
--header 'Content-Type: application/json' \
--data-raw '{
  "max_tokens": 1024,
  "messages": [
        {
            "role": "user",
            "content": "长文本-------"
        }
    ]
}'

目前不支持