Guides
Anthropic and Responses APIs
Both formats reach the same models, with the same prices and limits as /v1/chat/completions. Every model takes the three APIs.
What each format supports
| Feature | Chat Completions | Responses | Anthropic Messages |
|---|---|---|---|
| Endpoint | /v1/chat/completions | /v1/responses | /v1/messages |
| Streaming | Yes | Yes | Yes |
| Tool calling | Yes | Yes | Yes |
| Images | Yes | Yes | Yes |
| Video | Yes | Dropped, still billed | No (400) |
| Reasoning effort | Yes | Yes | Yes |
| Thinking text | Yes | Yes | With thinking on |
| Prompt caching | Yes | Yes | Yes |
previous_response_id | — | No | — |
| Files (PDF, Office, text) | Yes | Yes | Yes |
| Token counting | — | — | No |
| Web search and web fetch | Standard models | Standard models | Standard models |
Responses stores nothing: send the whole conversation in input with store set to false. store: true and previous_response_id return 400.
What works in each format
Every model takes these fields in any of the three formats, and the answer comes back in the format you sent, with or without streaming. Reasoning from earlier turns is passed along.
| Format | Supported on every model |
|---|---|
| Anthropic Messages | system, text and image blocks (base64 or URL), document blocks (base64 or text), images and documents inside a tool_result, tools and tool_choice, tool_use and tool_result, max_tokens, stop_sequences, temperature, top_p, top_k, thinking (enabled or adaptive) and output_config.effort as the reasoning effort, output_config.format (structured outputs) and metadata.user_id |
| Responses | instructions, input (text, messages, input_image and input_file), function tools, function_call and function_call_output (also with images and files), tool_choice (none, auto, required or a function), parallel_tool_calls, max_output_tokens, temperature, top_p, reasoning.effort, text.format (structured outputs) and text.verbosity |
Only on some models
| Format | Not supported on every model |
|---|---|
| Anthropic Messages | Images by file_id, Anthropic server tools (bash_*, text_editor_*, computer_*, code_execution_*), other thinking types such as between_tools, a final assistant message (prefill), container, mcp_servers and context_management |
| Responses | Tools other than function (such as custom), tool_choice allowed_tools or custom, item_reference, truncation: "auto", top_logprobs, max_tool_calls, and any include other than reasoning.encrypted_content |
With a model that does not take one of these, the answer is 400 invalid_request, and the message names the field. Don't rely on anthropic-beta headers: they are not always passed on.
A forced tool_choice (required, any or one tool) and structured outputs (output_config.format, text.format) are sent on every model, but only the models that list tool_choice or structured_outputs in supported_parameters (GET /v1/models) always follow them. Add "provider": {"require_parameters": true} to get 404 instead of a model that may not follow them.
Examples
import os
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.libremodel.ai",
api_key=os.environ["LIBREMODEL_API_KEY"],
)
message = client.messages.create(
model="deepseek-v4.1-flash-1017",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain why the sky is blue."}],
)
print(message.content[0].text)Errors
/v1/messages returns errors in the Anthropic shape, {"type": "error", "error": {"type", "message"}}, with the same status codes as the other endpoints. /v1/responses returns them in the OpenAI shape, the same as Chat Completions.