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/messageswith Hetzner Inference API. With the Anthropic API, thinking is turned off by default. If you do not need reasoning, choose a low level withoutput_config.effort. Withlow, 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, andGET /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 code404with the textroute not found. - Model names: Model names are case-sensitive. The API does not map names from other providers such as
gpt-4oto a Hetzner model. If you use a model name that does not exist or that your Inference Token cannot use, the API returns status code401. Check the model name withGET /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
temperatureandtop_pdepend 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, andpredictionwithout 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_callsfield. The value offinish_reasondoes not always show this. - Usage when streaming: Every chunk contains the current token usage in the
usagefield, even withoutstream_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 withprevious_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": truewith status code400. - No built-in tools: The API ignores built-in OpenAI tools such as
web_search,file_search, orcode_interpreterwithout an error. Only tools of the typefunctionwork. - Reasoning without summary: You find the full reasoning in the output item of the type
reasoningundercontent. Thesummaryfield stays empty, even withreasoning.summary: "auto".
Messages API
- Authentication: Send the Inference Token in the
Authorization: Bearerheader. Thex-api-keyheader is not supported. - No documents: The API rejects content blocks of the types
documentandfilewith status code400. Extract the text yourself and send it as atextblock. - No server tools: Anthropic server tools such as
web_searchorcode_executionare not available. Every tool needs aninput_schema. Otherwise, the API returns status code400. - 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 ofstop_reasondoes not always show this. cache_controlwithout 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-versionandanthropic-betaheaders. They have no effect. - Counting tokens: Depending on the model, the settings for
thinkingandoutput_configchange the number of input tokens. For this reason, pass the same settings to/v1/messages/count_tokensas in the actual request. - IDs: Message IDs start with
chatcmpl-instead ofmsg_. Tool use IDs start withchatcmpl-tool-.
Embeddings
- Text only: The API creates embeddings from text only.
dimensionsparameter: You can only set a custom number of dimensions for models that support Matryoshka embeddings. For other models, the API returns status code400.encoding_formatparameter: The API supports the valuesfloatandbase64.