For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create Chat Completions

Create Chat Completions by calling an available model in a format that is compatible with the OpenAI API. Supports both text-only and multimodal (text + images) inputs for compatible models. Rate limits apply per contract. Default limits apply unless a custom rate limit is configured for your contract. Exceeding the limit returns HTTP 429. The 429 carries no Retry-After header, so back off exponentially and watch X-RateLimit-Remaining-Requests. The request body is limited to 16 MiB total, regardless of content type. Multimodal requests are further limited to a 12 MiB decoded size per inline base64 image and 2048 content parts per message; exceeding any of these returns HTTP 413. Pass large images as a remote http(s) URL instead of inline base64 to stay under the body-size and per-image limits - it does not raise the 2048 content-parts cap.

post
Authorizations
AuthorizationstringRequired

Please provide header value as 'Bearer ' and don't forget to add 'Bearer' HTTP Authorization Scheme before the token.

Body
modelstringRequired

ID of the model to use

response_formatone ofOptional

An object specifying the format that the model must output. Use json_object for JSON mode or json_schema to enforce a specific schema (Structured Outputs). If omitted, default text output is used.

or
or
temperaturenumberOptional

The sampling temperature to be used

Default: 1
top_pnumber · max: 1Optional

An alternative to sampling with temperature. Must be greater than 0 when set; omit it to leave the model's own default in place.

nintegerOptional

The number of chat completion choices to generate for each input message

Default: 1
streambooleanOptional

If set to true, it sends partial message deltas

Default: false
stopone ofOptional

Up to 4 sequences where the API will stop generating further tokens. Either a single sequence or an array of them.

stringOptional
or
string[] · max: 4Optional
max_tokensintegerOptionalDeprecated

The maximum number of tokens to generate in the chat. This value is now deprecated in favor of max_completion_tokens completion

Default: 16
max_completion_tokensintegerOptional

An upper bound for the number of tokens that can be generated for a completion, including visible output tokens

Default: 16
presence_penaltynumberOptional

It is used to penalize new tokens based on their existence in the text so far

Default: 0
frequency_penaltynumberOptional

It is used to penalize new tokens based on their frequency in the text so far

Default: 0
logit_biasobjectOptional

Used to modify the probability of specific tokens appearing in the completion

logprobsbooleanOptional

Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message.

Default: false
top_logprobsinteger · max: 20Optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.

userstringOptional

A unique identifier representing your end-user

reasoning_effortstring · enumOptional

OpenAI-compatible field that controls the model's reasoning token budget. Supported values are low, medium, and high.

Default: mediumPossible values:
tool_choiceone ofOptional

Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool. none is the default when no tools are present. auto is the default if tools are present.

string · enumOptional

none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools.

Possible values:
or
Responses
200

Successful operation

application/json
post/v1/chat/completions
POST /v1/chat/completions HTTP/1.1
Host: openai.inference.de-txl.ionos.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 323

{
  "model": "meta-llama/Llama-3.3-70B-Instruct",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Please say hello."
    }
  ],
  "temperature": 0.7,
  "top_p": 0.9,
  "n": 1,
  "stream": false,
  "stop": [
    "\n"
  ],
  "max_tokens": 1000,
  "presence_penalty": 0,
  "frequency_penalty": 0,
  "logit_bias": {},
  "user": "user-123"
}
{
  "id": "text",
  "choices": [
    {
      "finish_reason": "text",
      "index": 1,
      "message": {
        "role": "text",
        "content": "text",
        "tool_calls": [
          {
            "id": "text",
            "type": "function",
            "function": {
              "name": "text",
              "arguments": "text"
            }
          }
        ],
        "refusal": "text"
      },
      "logprobs": {
        "content": [
          {
            "token": "text",
            "logprob": 1,
            "bytes": [
              1
            ],
            "top_logprobs": [
              {
                "token": "text",
                "logprob": 1,
                "bytes": [
                  1
                ]
              }
            ]
          }
        ]
      }
    }
  ],
  "created": 1,
  "object": "text",
  "model": "text",
  "system_fingerprint": "text",
  "usage": {
    "prompt_tokens": 1,
    "completion_tokens": 1,
    "total_tokens": 1,
    "completion_tokens_details": {
      "reasoning_tokens": 1
    }
  }
}

Last updated

Was this helpful?