Compatibility with OpenAI and Anthropic

Last change on 2026-11-11 • Created on 2026-11-11 • ID: AI-F5213

Hetzner Inference API is compatible with the OpenAI API and the Anthropic Messages API. You can keep using the official SDKs and most existing tools. You only change the base URL and use your Inference Token.

Supported endpoints

Endpoint API Description
GET /v1/models OpenAI Lists the models you can use with your Inference Token
POST /v1/chat/completions OpenAI Chat Completions API
POST /v1/responses OpenAI Responses API
POST /v1/embeddings OpenAI Creates embeddings
POST /v1/messages Anthropic Messages API
POST /v1/messages/count_tokens Anthropic Counts the input tokens of a request

Supported features

Feature Details
Streaming With "stream": true. Responses arrive as server-sent events.
Tool calling With the tools parameter. The model returns the function calls in tool_calls.
Structured output With response_format and the types json_object or json_schema.
Image input For GLM 5.3 Flash. Send images as base64 data URLs (data:image/png;base64,...).
Reasoning With a different parameter depending on the endpoint. For details, see Controlling reasoning.
Reproducible answers With the seed parameter. With a fixed value, the same request usually returns the same answer. This works with GLM 5.3, GLM 5.3 Flash, and Kolibri 1. Exactly the same answer is not guaranteed, for example after an update of the model.
Other parameters max_tokens, stop, n, logprobs, top_logprobs, and stream_options

Controlling reasoning

Depending on the endpoint, you use a different parameter to set how much a model reasons before it answers. The API also returns the reasoning in a different field depending on the endpoint:

Endpoint Parameter Field in the response
/v1/chat/completions reasoning_effort choices[0].message.reasoning, and choices[0].delta.reasoning when streaming
/v1/responses reasoning.effort Output item with "type": "reasoning"
/v1/messages output_config.effort Content block with "type": "thinking"

To see which levels a model supports, go to Models and licenses.

On /v1/messages, the API also accepts the thinking parameter with the types disabled, enabled, and adaptive. However, with GLM 5.3 Flash, "thinking": {"type": "disabled"} does not fully turn off reasoning. For this reason, use output_config.effort to set the reasoning level.

Please note: If a model reasons by default, it also reasons on /v1/messages with Hetzner Inference API. With the Anthropic API, thinking is turned off by default. If you do not need reasoning, choose a low level with output_config.effort. With low, GLM 5.3 Flash does not reason.

Using the OpenAI SDK

Set the base URL to https://inference.hetzner.com/v1 and pass your Inference Token in the api_key (Python) or apiKey (JavaScript) parameter. For examples in Python and JavaScript, see Generating text with Hetzner Inference API.

Using the Anthropic SDK

Set the base URL to https://inference.hetzner.com without /v1, because the Anthropic SDK adds /v1 on its own. Pass your Inference Token as auth_token (Python) or authToken (TypeScript). Older versions of the SDK send the value of api_key in the x-api-key header, which the API does not support.

For examples in Python and TypeScript, streaming, reasoning, and configuring tools with environment variables, see Using the Anthropic Messages API with Hetzner Inference API.

Known differences

All endpoints

  • Unsupported endpoints: The API does not support /v1/completions, /v1/files, /v1/uploads, /v1/batches, /v1/moderations, /v1/images/*, /v1/audio/*, /v1/fine_tuning/*, /v1/vector_stores, /v1/realtime, /v1/conversations, /v1/messages/batches, and GET /v1/models/{model}.
  • Model type and endpoint: Embedding models only work with /v1/embeddings. Chat models do not work with /v1/embeddings. If the model and the endpoint do not match, the API returns status code 404 with the text route not found.
  • Model names: Model names are case-sensitive. The API does not map names from other providers such as gpt-4o to a Hetzner model. If you use a model name that does not exist or that your Inference Token cannot use, the API returns status code 401. Check the model name with GET /v1/models.
  • Error format: Some errors arrive as plain text and not in the JSON format of OpenAI or Anthropic. Use the HTTP status code to handle errors. For details, see Error codes.
  • Images only as base64: The API rejects images from external URLs with status code 400.
  • Prompt caching: Prompt caching is always active. You do not need to configure it, and you cannot turn it off.
  • Default values: Default values for parameters such as temperature and top_p depend on the model. If you need specific values, set them in the request.

Chat Completions

  • Fields without effect: The API accepts the fields store, metadata, service_tier, user, modalities, audio, web_search_options, and prediction without an error. These fields have no effect. Unknown fields do not cause an error either, so check the spelling of your fields.
  • Detecting tool calls: To find out whether the model calls a tool, check the tool_calls field. The value of finish_reason does not always show this.
  • Usage when streaming: Every chunk contains the current token usage in the usage field, even without stream_options.

Responses API

  • No stored responses: The API does not store responses. You cannot retrieve a response with GET /v1/responses/{id} or continue it with previous_response_id. You also cannot delete or cancel a response. Send the full conversation with every request instead.
  • No background processing: The API rejects requests with "background": true with status code 400.
  • No built-in tools: The API ignores built-in OpenAI tools such as web_search, file_search, or code_interpreter without an error. Only tools of the type function work.
  • Reasoning without summary: You find the full reasoning in the output item of the type reasoning under content. The summary field stays empty, even with reasoning.summary: "auto".

Messages API

  • Authentication: Send the Inference Token in the Authorization: Bearer header. The x-api-key header is not supported.
  • No documents: The API rejects content blocks of the types document and file with status code 400. Extract the text yourself and send it as a text block.
  • No server tools: Anthropic server tools such as web_search or code_execution are not available. Every tool needs an input_schema. Otherwise, the API returns status code 400.
  • Detecting tool calls: To find out whether the model calls a tool, check the response for content blocks of the type tool_use. The value of stop_reason does not always show this.
  • cache_control without effect: The API accepts this field but ignores it. You cannot set cache breakpoints or a custom cache duration.
  • Headers without effect: You can send the anthropic-version and anthropic-beta headers. They have no effect.
  • Counting tokens: Depending on the model, the settings for thinking and output_config change the number of input tokens. For this reason, pass the same settings to /v1/messages/count_tokens as in the actual request.
  • IDs: Message IDs start with chatcmpl- instead of msg_. Tool use IDs start with chatcmpl-tool-.

Embeddings

  • Text only: The API creates embeddings from text only.
  • dimensions parameter: You can only set a custom number of dimensions for models that support Matryoshka embeddings. For other models, the API returns status code 400.
  • encoding_format parameter: The API supports the values float and base64.

Next steps

Table of Contents