Overview

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

Hetzner Inference API

The OpenAI & Anthropic-compatible Hetzner Inference API allows you to integrate various AI models into your own applications and projects. It does not provide a graphical user interface (GUI) and access is exclusively available through the API (see Generating text with Hetzner Inference API).

For a complete overview of all available models, visit our website at hetzner.com/ai/inference-api.

Token

AI models do not process text character by character. Instead, they break it down into fixed units (tokens). A single token can represent an entire word, a frequently occurring character combination, or even a single character. This approach makes text processing more efficient than processing each character individually.

The number of tokens into which a text is converted depends on the model and its tokenizer. A key factor is the size of the tokenizer's vocabulary, meaning how many subword units it recognizes. Example:

Vocabulary ┆ Tokens produced for the word
   size    ┆ "understanding" (13 characters)
╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
           ┆          ┌────┐ ┌─────┐ ┌────┐ ┌─────┐ ┌─────┐
    1k     ┆ 5 tokens | un | | der | | st | | and | | ing |
           ┆          └────┘ └─────┘ └────┘ └─────┘ └─────┘
           ┆          ┌───────┐ ┌───────┐ ┌─────┐
    50k    ┆ 3 tokens | under | | stand | | ing |
           ┆          └───────┘ └───────┘ └─────┘
           ┆          ┌───────┐ ┌──────────┐
    100k   ┆ 2 tokens | under | | standing |
           ┆          └───────┘ └──────────┘
This can reduce the number of tokens: This can increase the number of tokens:
  • Shorter prompts
  • Using common words (more likely that the words exists as a single token)
  • Longer prompts
  • Using rare / uncommon words (less likely that the words exists as a single token)
  • Typos
  • Less common languages with limited character-combination coverage

Prompt Caching

If you send a request to a model that starts with the same tokens as a previous request, the model does not need to reprocess this prefix. To do this, the API temporarily stores cached prefixes in memory. This allows for quicker response times and the use of cached input tokens, which are less expensive. Prompt caching is always active. You don't need to configure anything, and you can't turn it off.

How prompt caching works:

Description
Token blocks The API caches in blocks with a fixed number of tokens. The size of the block depends on the model. Only full blocks are used from the cache. Prompts that are shorter than one block are never cached.
Identical beginning The beginning of the request has to match the cached request token by token. Everything past the first point of divergence must be processed again.
Short period Cached prefixes are held briefly in memory and are automatically deleted, even sooner under high traffic. Therefore, cache hits are not guaranteed.
No access Cached prefixes are not stored permanently. Noone can access or view them, and we don't use them to train models.

To make effective use of caching, always place recurring content that doesn't change at the beginning. This includes system prompts, tool definitions, and long documents. Any content that changes, for example a new message, should be placed at the end.

Note: The API also converts tool definitions and other parameters into tokens and places them at the beginning of the prompt. If the order of JSON fields changes, your visible text will remain unchanged, but the tokens at the beginning of the prompt will differ. In this scenario, the API can not use the cache.

The number of tokens that came from cache is shown in the usage field in each response:

Endpoint Field
/v1/chat/completions usage.prompt_tokens_details.cached_tokens
/v1/responses usage.input_tokens_details.cached_tokens
/v1/messages usage.cache_read_input_tokens

In Hetzner Console, you can see the cached tokens per Inference Token and model in the section CACHED TOKENS.

Zero Data Retention (ZDR)

Requests and responses are never stored permanently, neither on disks nor in logs. They are not used for model training. This applies to all customers, you don't need to configure anything.

Since we don't store responses, you can't reference or retrieve previous responses. For conversations spanning multiple messages, include the full conversation history in each request. For more details, see Compatibility with OpenAI and Anthropic.

Pricing

Billing varies depending on the model, but most models are charged based on the number of tokens used.

For more information about pricing, see hetzner.com/ai/inference-api.

For detailed information on the billing model and invoicing, see the docs article "Billing for Hetzner Inference API".

Token usage:

The number of tokens that are used for input or output depends on the tokenizer that is used by the model. On our website, you can find a cost calculator that converts a prompt input into tokens based on a specific tokenizer: hetzner.com/ai/inference-api

Output vs. input

Generating a response with new content usually requires more computational work than processing the request (prompt). For this reason, output and input are billed separately at different pricing.

Limits

  • Up to 20 Inference Tokens per account
  • Up to 100 requests per minute (RPM) per model and Inference Token

Please check the article Limits for more information on limits and how to adjust them, if possible.

Next steps

Table of Contents