openai-sdk changedcli-sdks-libraries/libraries/openai-sdk
Nearest release: v2.1.315, published under an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+73added
Lines−68removed
From line
206
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits17to this page, all time
The whole hunk
from line 206, old and new numbered
/
from line 206
206206Here are the most substantial differences from using OpenAI:
207207
208208* The `strict` parameter for function calling is ignored, which means the tool use JSON is not guaranteed to follow the supplied schema. For guaranteed schema conformance, use the native [Claude API with structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs).
209* Audio input is not supported; it is ignored and stripped from input.
209* `response_format` accepts only `json_schema` with `strict: true`. A request that sets `json_object` or `text` returns a 400 error.
210* Audio and file inputs are not supported. A request that includes an `input_audio` or `file` content part returns a 400 error.
210211* Prompt caching is not supported, but it is supported in the [Anthropic SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview).
211212* System/developer messages are hoisted and concatenated into the top-level `system` field, wherever they appear in the conversation. To add system instructions partway through a conversation, use [mid-conversation system messages](https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages) in the native Claude API.
212213
from line 223
222223
223224### Thinking support
224225
225You can enable [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) by adding the `thinking` parameter. On current models thinking is adaptive, with Claude determining when and how deeply to think, and on Claude 5 models it is on by default; manually configured extended thinking is a legacy mode. Although thinking improves Claude’s reasoning for complex tasks, the OpenAI SDK doesn’t return Claude’s thinking. For full thinking features, including [summarized thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#summarized-thinking), use the native Claude API.
226On Claude 5 models and Claude Mythos Preview, [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) is on by default, so you can omit the `thinking` field. To use thinking on other models through the compatibility layer, set the `thinking` field of the request body to `{"type": "enabled", "budget_tokens": N}`. `N` must be at least 1,024 and less than `max_tokens` or `max_completion_tokens`, whichever you set.
226227
228The compatibility layer differs from the native Claude API in the following ways:
229
230* The response doesn’t include Claude’s thinking. The native Claude API can return [summarized thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#summarized-thinking).
231* Setting `thinking` to `{"type": "adaptive"}` returns a 400 error.
232* On [models that reject `enabled`](https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#rejected-configurations) in the native Claude API, the compatibility layer converts `enabled` to adaptive thinking. On those models, `budget_tokens` is required but has no effect.
233
234The OpenAI SDK has no `thinking` parameter, so the following example sends it as an extra field in the request body.
235
227236<CodeGroup exclude="shell, php">
228237 ```python Python
229238 response = client.chat.completions.create(
from line 314
305314
306315#### Simple fields
307316
308| Field | Support status |
309| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
310| `model` | Use Claude model names |
311| `max_tokens` | Fully supported |
312| `max_completion_tokens` | Fully supported |
313| `stream` | Fully supported |
314| `stream_options` | Fully supported |
315| `top_p` | Passed through to the model. Claude 4.7 and later models and Claude Mythos Preview return a 400 error for any value other than `0.99`, the default, so omit it. A request that sets both `temperature` and `top_p` also returns a 400 error. See [Working with messages](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). |
316| `parallel_tool_calls` | Fully supported |
317| `stop` | All non-whitespace stop sequences work |
318| `temperature` | Between 0 and 1 (inclusive). Values greater than 1 are capped at 1. On Claude 4.7 and later models and Claude Mythos Preview, any value below 1 returns a 400 error, so omit it. See [Working with messages](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). |
319| `n` | Must be exactly 1 |
320| `logprobs` | Ignored |
321| `metadata` | Ignored |
322| `response_format` | Ignored. For JSON output, use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) with the native Claude API. |
323| `prediction` | Ignored |
324| `presence_penalty` | Ignored |
325| `frequency_penalty` | Ignored |
326| `seed` | Ignored |
327| `service_tier` | Ignored |
328| `audio` | Ignored |
329| `logit_bias` | Ignored |
330| `store` | Ignored |
331| `user` | Ignored |
332| `modalities` | Ignored |
333| `top_logprobs` | Ignored |
334| `reasoning_effort` | Ignored |
317| Field | Support status |
318| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
319| `model` | Use Claude model names |
320| `max_tokens` | Fully supported |
321| `max_completion_tokens` | Fully supported |
322| `stream` | Fully supported |
323| `stream_options` | Fully supported |
324| `top_p` | Passed through to the model. Claude 4.7 and later models and Claude Mythos Preview return a 400 error for any value other than `0.99`, the default, so omit it. A request that sets both `temperature` and `top_p` also returns a 400 error. See [Using the Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). |
325| `parallel_tool_calls` | Fully supported |
326| `tool_choice` | Supported with limits. `"required"` and a named function force a tool call. Claude Opus 5.5, Claude Sonnet 5.5, Claude Fable 5.1, and Claude Mythos 5.1 don’t support forced tool use and return a 400 error, so use `"auto"` on those models. See [Forcing tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#forcing-tool-use). |
327| `stop` | All non-whitespace stop sequences work |
328| `temperature` | Between 0 and 1 (inclusive). Values greater than 1 are capped at 1. On Claude 4.7 and later models and Claude Mythos Preview, any value below 1 returns a 400 error, so omit it. See [Using the Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). |
329| `n` | Must be exactly 1. Any other value returns a 400 error. |
330| `response_format` | Supported with limits. Only `json_schema` with `strict: true` is accepted, and the structured outputs [JSON Schema limitations](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#json-schema-limitations) apply. Any other value, including `json_object` and `text`, returns a 400 error. |
331| `logprobs` | Ignored |
332| `metadata` | Ignored |
333| `prediction` | Ignored |
334| `presence_penalty` | Ignored |
335| `frequency_penalty` | Ignored |
336| `seed` | Ignored |
337| `service_tier` | Ignored |
338| `audio` | Ignored |
339| `logit_bias` | Ignored |
340| `store` | Ignored |
341| `user` | Ignored |
342| `modalities` | Ignored |
343| `top_logprobs` | Ignored |
344| `reasoning_effort` | Ignored |
335345
336346#### `tools` / `functions` fields
337347
from line 408
398408 <Tab title="User role">
399409 Fields for `messages[n].role == "user"`
400410
401 | Field | Variant | Sub-field | Support status |
402 | --------- | -------------------------------- | --------- | --------------- |
403 | `content` | `string` | | Fully supported |
404 | | `array`, `type == "text"` | | Fully supported |
405 | | `array`, `type == "image_url"` | `url` | Fully supported |
406 | | | `detail` | Ignored |
407 | | `array`, `type == "input_audio"` | | Ignored |
408 | | `array`, `type == "file"` | | Ignored |
409 | `name` | | | Ignored |
411 | Field | Variant | Sub-field | Support status |
412 | --------- | -------------------------------- | --------- | ------------------- |
413 | `content` | `string` | | Fully supported |
414 | | `array`, `type == "text"` | | Fully supported |
415 | | `array`, `type == "image_url"` | `url` | Fully supported |
416 | | | `detail` | Ignored |
417 | | `array`, `type == "input_audio"` | | Returns a 400 error |
418 | | `array`, `type == "file"` | | Returns a 400 error |
419 | `name` | | | Ignored |
410420 </Tab>
411421
412422 <Tab title="Assistant role">
from line 436
426436 <Tab title="Tool role">
427437 Fields for `messages[n].role == "tool"`
428438
429 | Field | Variant | Support status |
430 | -------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
431 | `content` | `string` | Fully supported |
432 | | `array`, `type == "text"` | Fully supported |
433 | `tool_call_id` | | Fully supported |
434 | `tool_choice` | | Supported. `"required"` and named-function values force a tool call; Claude Opus 5.5, Claude Sonnet 5.5, Claude Fable 5.1, and Claude Mythos 5.1 don’t support forced tool use and return an error, so use `"auto"` on those models. See [Forcing tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#forcing-tool-use). |
435 | `name` | | Ignored |
439 | Field | Variant | Support status |
440 | -------------- | ------------------------- | --------------- |
441 | `content` | `string` | Fully supported |
442 | | `array`, `type == "text"` | Fully supported |
443 | `tool_call_id` | | Fully supported |
444 | `name` | | Ignored |
436445 </Tab>
437446
438447 <Tab title="Function role">
439448 Fields for `messages[n].role == "function"`
440449
441 | Field | Variant | Support status |
442 | ------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
443 | `content` | `string` | Fully supported |
444 | | `array`, `type == "text"` | Fully supported |
445 | `tool_choice` | | Supported. `"required"` and named-function values force a tool call; Claude Opus 5.5, Claude Sonnet 5.5, Claude Fable 5.1, and Claude Mythos 5.1 don’t support forced tool use and return an error, so use `"auto"` on those models. See [Forcing tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#forcing-tool-use). |
446 | `name` | | Ignored |
450 | Field | Variant | Support status |
451 | --------- | -------- | ---------------------------------- |
452 | `content` | `string` | Fully supported |
453 | `name` | | Required, but the value is ignored |
447454 </Tab>
448455 </Tabs>
449456</Accordion>
from line 469
462469| `object` | Fully supported |
463470| `created` | Fully supported |
464471| `model` | Fully supported |
465| `finish_reason` | Fully supported |
466| `content` | Fully supported |
467472| `usage.completion_tokens` | Fully supported |
468473| `usage.prompt_tokens` | Fully supported |
469474| `usage.total_tokens` | Fully supported |
from line 486
481486
482487### Header compatibility
483488
484Although the OpenAI SDK automatically manages headers, here is the complete list of headers supported by the Claude API for developers who need to work with them directly.
489If your code reads or sets headers directly, the following table shows how the Claude API handles OpenAI’s headers.
485490
486| Header | Support status |
487| -------------------------------- | ------------------- |
488| `x-ratelimit-limit-requests` | Fully supported |
489| `x-ratelimit-limit-tokens` | Fully supported |
490| `x-ratelimit-remaining-requests` | Fully supported |
491| `x-ratelimit-remaining-tokens` | Fully supported |
492| `x-ratelimit-reset-requests` | Fully supported |
493| `x-ratelimit-reset-tokens` | Fully supported |
494| `retry-after` | Fully supported |
495| `request-id` | Fully supported |
496| `openai-version` | Always `2020-10-01` |
497| `authorization` | Fully supported |
498| `openai-processing-ms` | Always empty |
491| Header | Support status |
492| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
493| `x-ratelimit-limit-requests` | Not returned. The request limit is in `x-ratelimit-requests`. |
494| `x-ratelimit-limit-tokens` | Not returned. The token limit is in `x-ratelimit-tokens`. |
495| `x-ratelimit-remaining-requests` | Fully supported |
496| `x-ratelimit-remaining-tokens` | Fully supported |
497| `x-ratelimit-reset-requests` | Fully supported |
498| `x-ratelimit-reset-tokens` | Fully supported |
499| `retry-after` | Fully supported |
500| `x-request-id` | Fully supported. Carries the Claude API [request ID](https://platform.claude.com/docs/en/api/errors#request-id) in place of the `request-id` header. |
501| `openai-version` | Not returned |
502| `openai-processing-ms` | Not returned |
503| `authorization` | Fully supported |
499504
500505## Availability
501506
No line in this hunk matches that.