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.
Please provide header value as 'Bearer ' and don't forget to add 'Bearer' HTTP Authorization Scheme before the token.
ID of the model to use
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.
The sampling temperature to be used
1An alternative to sampling with temperature. Must be greater than 0 when set; omit it to leave the model's own default in place.
The number of chat completion choices to generate for each input message
1If set to true, it sends partial message deltas
falseUp to 4 sequences where the API will stop generating further tokens. Either a single sequence or an array of them.
The maximum number of tokens to generate in the chat. This value is now deprecated in favor of max_completion_tokens completion
16An upper bound for the number of tokens that can be generated for a completion, including visible output tokens
16It is used to penalize new tokens based on their existence in the text so far
0It is used to penalize new tokens based on their frequency in the text so far
0Used to modify the probability of specific tokens appearing in the completion
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.
falseAn 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.
A unique identifier representing your end-user
OpenAI-compatible field that controls the model's reasoning token
budget. Supported values are low, medium, and high.
mediumPossible values: 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.
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.
Successful operation
The request was rejected before it reached a model. The message names the field at fault.
The request body, an inline base64 media payload, or the number of content parts in a single message, query, or document exceeds a documented limit, or a requested image's width or height is above the maximum supported size. Pass large media as a remote http(s) URL instead of inline base64 - a remote URL is fetched directly by the model and does not count against the request body size.
Rate limit exceeded. This response carries no Retry-After header, so back off exponentially and watch X-RateLimit-Remaining-Requests on successful responses to slow down before reaching the limit. Limits are contract-specific.
The request failed on our side. It may or may not have been carried out, so a retry is safe for idempotent calls.
The platform is temporarily overloaded and is shedding load to stay stable. Retry after the number of seconds indicated by the Retry-After header. This is unrelated to your contract's rate limits.
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?