Skip to main content
POST
/
chat
/
completions
Error
A valid request URL is required to generate request examples
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "system",
        "content": "<string>",
        "name": "<string>",
        "tool_calls": [
          {
            "id": "<string>",
            "type": "function",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            }
          }
        ],
        "tool_call_id": "<string>"
      },
      "finish_reason": "stop",
      "logprobs": {
        "content": [
          {
            "token": "<string>",
            "logprob": 123,
            "bytes": [
              123
            ],
            "top_logprobs": [
              {
                "token": "<string>",
                "logprob": 123,
                "bytes": [
                  123
                ]
              }
            ]
          }
        ]
      }
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123
    },
    "completion_tokens_details": {
      "reasoning_tokens": 123,
      "accepted_prediction_tokens": 123,
      "rejected_prediction_tokens": 123
    },
    "cache_creation_input_tokens": 123,
    "cache_read_input_tokens": 123
  },
  "system_fingerprint": "<string>"
}

Authorizations

Authorization
string
header
required

API key passed as a Bearer token.

Body

application/json
model
string
required

Model identifier (e.g. gpt-4o, claude-3-sonnet).

messages
object[]
required

List of messages comprising the conversation.

temperature
number<double> | null

Sampling temperature (0–2).

max_completion_tokens
integer | null

Maximum number of tokens to generate.

top_p
number<double> | null

Nucleus sampling parameter.

frequency_penalty
number<double> | null

Frequency penalty (−2.0 to 2.0).

presence_penalty
number<double> | null

Presence penalty (−2.0 to 2.0).

stop
string[]

Stop sequences.

stream
boolean
default:false

Whether to stream partial responses via SSE.

tools
object[]

List of tools the model may call.

tool_choice
any

Controls which tool is called. Can be "none", "auto", or an object like {"type": "function", "function": {"name": "my_fn"}}.

response_format
object
seed
integer | null

Seed for deterministic sampling.

user
string

End-user identifier for abuse monitoring.

n
integer | null

Number of completions to generate.

logprobs
boolean | null

Whether to return log probabilities.

top_logprobs
integer | null

Number of most likely tokens to return (0–20).

stream_options
object

Response

Chat completion response (non-streaming)

id
string
object
string
Example:

"chat.completion"

created
integer<int64>
model
string
choices
object[]
usage
object
system_fingerprint
string