Anthropic 提供相容性層,讓您能夠使用 OpenAI SDK 來測試 Anthropic API。只需進行少量程式碼變更,您就能快速評估 Anthropic 模型的能力。
strict
參數會被忽略,這意味著工具使用 JSON 不保證遵循提供的架構。\n
)將它們串聯在一起。然後將此完整字串作為單一系統訊息提供在訊息的開頭。
thinking
參數來啟用延伸思考功能。雖然這會改善 Claude 對複雜任務的推理,但 OpenAI SDK 不會回傳 Claude 的詳細思考過程。要獲得完整的延伸思考功能,包括存取 Claude 的逐步推理輸出,請使用原生 Anthropic API。
/v1/messages
端點的標準限制。
欄位 | 支援狀態 |
---|---|
model | 使用 Claude 模型名稱 |
max_tokens | 完全支援 |
max_completion_tokens | 完全支援 |
stream | 完全支援 |
stream_options | 完全支援 |
top_p | 完全支援 |
parallel_tool_calls | 完全支援 |
stop | 所有非空白停止序列都有效 |
temperature | 介於 0 和 1 之間(包含)。大於 1 的值會被限制為 1。 |
n | 必須恰好為 1 |
logprobs | 忽略 |
metadata | 忽略 |
response_format | 忽略 |
prediction | 忽略 |
presence_penalty | 忽略 |
frequency_penalty | 忽略 |
seed | 忽略 |
service_tier | 忽略 |
audio | 忽略 |
logit_bias | 忽略 |
store | 忽略 |
user | 忽略 |
modalities | 忽略 |
top_logprobs | 忽略 |
reasoning_effort | 忽略 |
tools
/ functions
欄位顯示欄位
tools[n].function
欄位欄位 | 支援狀態 |
---|---|
name | 完全支援 |
description | 完全支援 |
parameters | 完全支援 |
strict | 忽略 |
messages
陣列欄位顯示欄位
messages[n].role == "developer"
的欄位欄位 | 支援狀態 |
---|---|
content | 完全支援,但會被提升 |
name | 忽略 |
欄位 | 支援狀態 |
---|---|
id | 完全支援 |
choices[] | 長度永遠為 1 |
choices[].finish_reason | 完全支援 |
choices[].index | 完全支援 |
choices[].message.role | 完全支援 |
choices[].message.content | 完全支援 |
choices[].message.tool_calls | 完全支援 |
object | 完全支援 |
created | 完全支援 |
model | 完全支援 |
finish_reason | 完全支援 |
content | 完全支援 |
usage.completion_tokens | 完全支援 |
usage.prompt_tokens | 完全支援 |
usage.total_tokens | 完全支援 |
usage.completion_tokens_details | 永遠為空 |
usage.prompt_tokens_details | 永遠為空 |
choices[].message.refusal | 永遠為空 |
choices[].message.audio | 永遠為空 |
logprobs | 永遠為空 |
service_tier | 永遠為空 |
system_fingerprint | 永遠為空 |
標頭 | 支援狀態 |
---|---|
x-ratelimit-limit-requests | 完全支援 |
x-ratelimit-limit-tokens | 完全支援 |
x-ratelimit-remaining-requests | 完全支援 |
x-ratelimit-remaining-tokens | 完全支援 |
x-ratelimit-reset-requests | 完全支援 |
x-ratelimit-reset-tokens | 完全支援 |
retry-after | 完全支援 |
request-id | 完全支援 |
openai-version | 永遠為 2020-10-01 |
authorization | 完全支援 |
openai-processing-ms | 永遠為空 |