Skip to main content
POST
/
api
/
v1
/
openai
/
chat
/
completions
Create Chat Completion
curl --request POST \
  --url https://api.example.com/api/v1/openai/chat/completions \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {
      "content": "<string>",
      "role": "<string>",
      "name": "<string>"
    }
  ],
  "model": "<string>",
  "audio": {
    "format": "wav",
    "voice": "<string>"
  },
  "frequency_penalty": 123,
  "function_call": "none",
  "functions": [
    {
      "name": "<string>",
      "description": "<string>",
      "parameters": {}
    }
  ],
  "logit_bias": {},
  "logprobs": true,
  "max_completion_tokens": 123,
  "max_tokens": 123,
  "metadata": {},
  "modalities": [
    "text"
  ],
  "n": 123,
  "parallel_tool_calls": true,
  "prediction": {
    "content": "<string>",
    "type": "<string>"
  },
  "presence_penalty": 123,
  "reasoning_effort": "none",
  "response_format": {
    "type": "<string>"
  },
  "seed": 123,
  "service_tier": "auto",
  "stop": "<string>",
  "store": true,
  "stream": true,
  "stream_options": {
    "include_obfuscation": true,
    "include_usage": true
  },
  "temperature": 123,
  "tool_choice": "none",
  "tools": [
    {
      "function": {
        "name": "<string>",
        "description": "<string>",
        "parameters": {},
        "strict": true
      },
      "type": "<string>"
    }
  ],
  "top_logprobs": 123,
  "top_p": 123,
  "user": "<string>",
  "web_search_options": {
    "search_context_size": "low",
    "user_location": {
      "approximate": {
        "city": "<string>",
        "country": "<string>",
        "region": "<string>",
        "timezone": "<string>"
      },
      "type": "<string>"
    }
  }
}
'
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>",
      "input": "<unknown>",
      "ctx": {}
    }
  ]
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Body

application/json

Corresponds to args to OpenAI client.chat.completions.create(...)

messages
(ChatCompletionDeveloperMessageParam · object | ChatCompletionSystemMessageParam · object | ChatCompletionUserMessageParam · object | ChatCompletionAssistantMessageParam · object | ChatCompletionToolMessageParam · object | ChatCompletionFunctionMessageParam · object)[]
required

Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, developer messages replace the previous system messages.

model
required
audio
ChatCompletionAudioParam · object

Parameters for audio output.

Required when audio output is requested with modalities: ["audio"]. Learn more.

frequency_penalty
number | null
function_call
Available options:
none,
auto
functions
Function · object[] | null
logit_bias
Logit Bias · object
logprobs
boolean | null
max_completion_tokens
integer | null
max_tokens
integer | null
metadata
Metadata · object
modalities
enum<string>[] | null
Available options:
text,
audio
n
integer | null
parallel_tool_calls
boolean | null
prediction
ChatCompletionPredictionContentParam · object

Static predicted output content, such as the content of a text file that is being regenerated.

presence_penalty
number | null
reasoning_effort
enum<string> | null
Available options:
none,
minimal,
low,
medium,
high,
xhigh
response_format
ResponseFormatText · object

Default response format. Used to generate text responses.

seed
integer | null
service_tier
enum<string> | null
Available options:
auto,
default,
flex,
scale,
priority
stop
store
boolean | null
stream
boolean | null
stream_options
ChatCompletionStreamOptionsParam · object

Options for streaming response. Only set this when you set stream: true.

temperature
number | null
tool_choice
Available options:
none,
auto,
required
tools
ChatCompletionFunctionToolParam · object[] | null
top_logprobs
integer | null
top_p
number | null
user
string | null
web_search_options
WebSearchOptions · object

This tool searches the web for relevant results to use in a response. Learn more about the web search tool.

Response

Successful Response