# Claude family API: model IDs, choosing an endpoint, examples and common errors Source: https://ofox.ai/docs/develop/models/claude Anthropic's Claude models, including the Opus, Sonnet, Haiku and Fable series. We recommend calling them through the **Anthropic-native API**, where extended thinking, prompt caching, PDF input and other features behave as in the official API. The OpenAI-compatible API also works and suits projects that already use the OpenAI SDK. ## Common tasks - [Enable extended thinking](https://ofox.ai/docs/develop/models/claude/thinking) — thinking, budget_tokens, adaptive, and how to read the thinking content. - [Prompt caching](https://ofox.ai/docs/develop/models/claude/caching) — cache_control, 1-hour caching, and how to confirm a cache hit. - [Web search](https://ofox.ai/docs/develop/models/claude/web-search) — The web_search tool; requires the Anthropic provider. - [Long context & PDF](https://ofox.ai/docs/develop/models/claude/pdf) — 1M context and PDF uploads. - [Troubleshooting errors](#errors) — prompt is too long, model not found, truncated responses. - [Use in Claude Code](https://ofox.ai/docs/integrations/claude-code) — Setup and common questions. ## Models All models accept text, image and PDF input and support tool calling. For the full model list and live prices, see the [model page](https://ofox.ai/models?provider=anthropic), or query the [Models API](https://ofox.ai/docs/api/openai/models). **Common model IDs (copy them exactly)** - Claude Opus 5.5: `anthropic/claude-opus-5.5` - Claude Sonnet 5.5: `anthropic/claude-sonnet-5.5` - Claude Haiku 5.5: `anthropic/claude-haiku-5.5` - Claude Fable 5.1: `anthropic/claude-fable-5.1` You can omit the `anthropic/` prefix or use Anthropic's official format. All of the following refer to the same model: | Format | Example | |---|---| | OfoxAI standard | `anthropic/claude-sonnet-4.6` | | Prefix omitted | `claude-sonnet-4.6` | | Official (hyphens) | `claude-sonnet-4-6` | | Official with date | `claude-sonnet-4-6-20260217` | The aliases available for each model are listed in the `aliases` field returned by the Models API. The `model` field in responses always uses the standard format. ## Choosing an endpoint **Key point**:Use the Anthropic-native API for extended thinking, prompt caching, or tools such as Claude Code. | | Anthropic-native API (recommended) | OpenAI-compatible API | |---|---|---| | Endpoint | `POST https://api.ofox.ai/anthropic/v1/messages` | `POST https://api.ofox.ai/v1/chat/completions` | | SDK `base_url` | `https://api.ofox.ai/anthropic` | `https://api.ofox.ai/v1` | | Authentication | `x-api-key: `; `Authorization: Bearer ` is also accepted | `Authorization: Bearer ` | | [Extended thinking](https://ofox.ai/docs/develop/models/claude/thinking) | `thinking` parameter; returns `thinking` blocks | `reasoning` parameter; returns `reasoning_details` | | [Prompt caching](https://ofox.ai/docs/develop/models/claude/caching) | `cache_control`; usage reports both cache writes and reads | Add `cache_control` to message content blocks; usage reports reads only | | [PDF](https://ofox.ai/docs/develop/models/claude/pdf) | `document` content block | `file` content block | | [Web search](https://ofox.ai/docs/develop/models/claude/web-search) | Supported (requires the Anthropic provider) | Not supported | For the full request parameters, see the [Anthropic Messages API](https://ofox.ai/docs/api/anthropic/messages) and the [Chat Completions API](https://ofox.ai/docs/api/openai/chat-completions). ### Providers Claude models are served by two providers, and the same model supports different features on each: | Provider | Models | Endpoints | Notes | |---|---|---|---| | Amazon Bedrock (`aws_bedrock`) | All models | Both | Default provider | | Anthropic (`anthropic`) | Fable 5, Opus 4.8, Opus 4.7, Sonnet 5 | Anthropic-native API only | Supports [web search](https://ofox.ai/docs/develop/models/claude/web-search); must be selected explicitly | On the Anthropic-native API, you can select the provider with a request header: ```bash -H "X-OfoxAI-Provider-Type: anthropic" ``` If the selected provider doesn't serve the model, the request returns 400 and the error message lists the available providers, for example: ```text No available channel for platform 'anthropic' on model 'anthropic/claude-sonnet-4.6'. Available platforms for this model: aws_bedrock. ``` For other ways to select a provider, see [Provider routing](https://ofox.ai/docs/develop/advanced/provider-routing). ## Examples **Python (Anthropic SDK)** ```python filename="claude_basic.py" import os import anthropic client = anthropic.Anthropic( base_url="https://api.ofox.ai/anthropic", api_key=os.environ["OFOX_API_KEY"], ) message = client.messages.create( model="anthropic/claude-sonnet-4.6", max_tokens=1024, system="You are a senior backend engineer. Keep answers concise.", messages=[{"role": "user", "content": "Explain idempotency in one sentence."}], ) print(message.content[0].text) ``` **cURL** ```bash filename="Terminal" curl https://api.ofox.ai/anthropic/v1/messages \ -H "x-api-key: $OFOX_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic/claude-sonnet-4.6", "max_tokens": 1024, "messages": [{"role": "user", "content": "Explain idempotency in one sentence."}] }' ``` **Python (OpenAI SDK)** ```python filename="claude_openai_sdk.py" import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.chat.completions.create( model="anthropic/claude-sonnet-4.6", max_tokens=1024, messages=[{"role": "user", "content": "Explain idempotency in one sentence."}], ) print(resp.choices[0].message.content) ``` `max_tokens` is required on the Anthropic-native API and must not exceed the model's maximum output. ## Use in Claude Code Claude Code calls the Anthropic-native API, with the base URL `https://api.ofox.ai/anthropic`. For setup steps, see [Claude Code setup](https://ofox.ai/docs/integrations/claude-code). **Claude Code settings** - ANTHROPIC_BASE_URL: `https://api.ofox.ai/anthropic` - ANTHROPIC_AUTH_TOKEN: Paste your OfoxAI API key ## Common errors **Key point**:Parameter errors return 400 with a reason. A truncated response is not an error; check stop_reason. | HTTP · type | Error message | Cause | Fix | |---|---|---|---| | 400 `ValidationException` | `prompt is too long: 280527 tokens > 200000 maximum` | Input exceeds the model's context window | Shorten the input, or switch to a model with 1M context (any model other than Haiku 4.5) | | 404 `model_not_found` | `Model 'anthropic/claude-sonnet-9' not found` | Model ID misspelled, or the model has been retired | Copy the model ID from this page | | 401 `invalid_api_key` | `Invalid or expired API key` | Key is wrong, deleted or expired | Check the key in the console; on the native API, check the `x-api-key` header | | 400 | `No available channel for platform 'anthropic' on model ...` | The selected provider doesn't serve this model | Remove the provider selection, or use a provider listed in the error message — see [Providers](#provider) | | 200, `stop_reason: "max_tokens"` | — | Output reached the `max_tokens` limit and the response was truncated | Increase `max_tokens`; with thinking enabled, thinking also counts against this limit | For other general errors, see [Error Handling](https://ofox.ai/docs/develop/guides/error-handling). ## Official docs - [Anthropic · Models overview](https://docs.anthropic.com/en/docs/about-claude/models/overview) - [Anthropic · Extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) - [Anthropic · Prompt caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching) - [Anthropic · PDF support](https://docs.anthropic.com/en/docs/build-with-claude/pdf-support) The official docs describe behavior when calling Anthropic directly. When calling through OfoxAI, model IDs and endpoints on this page take precedence. ## FAQ **How do I write a Claude model ID?** The standard format is anthropic/claude-sonnet-4.6. You can also omit the anthropic/ prefix, or use the official formats claude-sonnet-4-6 and claude-sonnet-4-6-20260217; all refer to the same model. **Can I call Claude with the OpenAI SDK?** Yes. Set base_url to https://api.ofox.ai/v1 and use a model ID such as anthropic/claude-sonnet-4.6. If you need extended thinking or full cache usage details, we recommend the Anthropic-native API. **How do I enable thinking for Claude?** On the native API, pass thinking: {"type": "enabled", "budget_tokens": 2000}, where budget_tokens is at least 1024 and less than max_tokens; or pass {"type": "adaptive"} to let the model decide. On the OpenAI-compatible API, pass reasoning: {"max_tokens": 2000}. Do not set temperature when thinking is enabled. **What should I do if Claude prompt caching is not working?** Check in order: whether cache_control is set on the fixed content blocks (neither endpoint caches automatically); whether the content reaches the minimum cacheable length; whether the prefixes of the two requests are exactly identical; and whether more than 5 minutes passed between the two requests. **How do I fix the error prompt is too long?** The input exceeds the model context window. Haiku 4.5 has a 200K-token context; other Claude models have 1M tokens. Switch to another model or shorten the input. **Does Claude support 1M context? Do I need a beta header?** All models except Haiku 4.5 support 1M context. On OfoxAI no beta header is needed. **What should I do if Claude responses are truncated?** Check stop_reason in the response. If it is max_tokens, the output hit the limit; increase max_tokens. With thinking enabled, thinking content also counts against max_tokens. **Which provider serves Claude on OfoxAI?** All models are served by Amazon Bedrock, the default provider. Fable 5, Opus 4.8, Opus 4.7 and Sonnet 5 are also available from the Anthropic provider, on the Anthropic-native API only; select it with the X-OfoxAI-Provider-Type: anthropic header. **Can Claude search the web?** Yes, but it requires the Anthropic provider, is limited to Fable 5, Opus 4.8, Opus 4.7 and Sonnet 5, and works only on the Anthropic-native API. Add {"type": "web_search_20250305", "name": "web_search"} to tools. **Can Claude read PDFs?** Yes. On the native API, pass a base64-encoded PDF in a document content block; on the OpenAI-compatible API, use a file content block with file_data in the data:application/pdf;base64,... format.