POST
/
chat
/
completions
curl --request POST \
  --url https://api.openai.com/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "metadata": {},
  "temperature": 1,
  "top_p": 1,
  "user": "user-1234",
  "service_tier": "auto",
  "messages": [
    {
      "content": "<string>",
      "role": "developer",
      "name": "<string>"
    }
  ],
  "model": "gpt-4o",
  "modalities": [
    "text"
  ],
  "reasoning_effort": "medium",
  "max_completion_tokens": 123,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "web_search_options": {
    "user_location": {
      "type": "approximate",
      "approximate": {
        "country": "<string>",
        "region": "<string>",
        "city": "<string>",
        "timezone": "<string>"
      }
    },
    "search_context_size": "medium"
  },
  "top_logprobs": 10,
  "response_format": {
    "type": "text"
  },
  "audio": {
    "voice": "ash",
    "format": "wav"
  },
  "store": false,
  "stream": false,
  "stop": "\n",
  "logit_bias": null,
  "logprobs": false,
  "max_tokens": 123,
  "n": 1,
  "prediction": {
    "type": "content",
    "content": "<string>"
  },
  "seed": 0,
  "stream_options": null,
  "tools": [
    {
      "type": "function",
      "function": {
        "description": "<string>",
        "name": "<string>",
        "parameters": {},
        "strict": false
      }
    }
  ],
  "tool_choice": "none",
  "parallel_tool_calls": true,
  "function_call": "none",
  "functions": [
    {
      "description": "<string>",
      "name": "<string>",
      "parameters": {}
    }
  ]
}'
{
  "id": "<string>",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 123,
      "message": {
        "content": "<string>",
        "refusal": "<string>",
        "tool_calls": [
          {
            "id": "<string>",
            "type": "function",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            }
          }
        ],
        "annotations": [
          {
            "type": "url_citation",
            "url_citation": {
              "end_index": 123,
              "start_index": 123,
              "url": "<string>",
              "title": "<string>"
            }
          }
        ],
        "role": "assistant",
        "function_call": {
          "arguments": "<string>",
          "name": "<string>"
        },
        "audio": {
          "id": "<string>",
          "expires_at": 123,
          "data": "<string>",
          "transcript": "<string>"
        }
      },
      "logprobs": {
        "content": [
          {
            "token": "<string>",
            "logprob": 123,
            "bytes": [
              123
            ],
            "top_logprobs": [
              {
                "token": "<string>",
                "logprob": 123,
                "bytes": [
                  123
                ]
              }
            ]
          }
        ],
        "refusal": [
          {
            "token": "<string>",
            "logprob": 123,
            "bytes": [
              123
            ],
            "top_logprobs": [
              {
                "token": "<string>",
                "logprob": 123,
                "bytes": [
                  123
                ]
              }
            ]
          }
        ]
      }
    }
  ],
  "created": 123,
  "model": "<string>",
  "service_tier": "auto",
  "system_fingerprint": "<string>",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0,
    "completion_tokens_details": {
      "accepted_prediction_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "prompt_tokens_details": {
      "audio_tokens": 0,
      "cached_tokens": 0
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Response

200
application/json

OK

Represents a chat completion response returned by model, based on the provided input.