Skip to main content
POST
Create Chat Completion

Authorizations

Authorization
string
header
required

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

Body

application/json
model
enum<string>
required

Model to use, for example, sonar-pro

Available options:
sonar,
sonar-pro,
sonar-deep-research,
sonar-reasoning-pro
messages
ChatMessage · object[]
required
max_tokens
integer | null
Required range: 0 < x <= 128000
stream
boolean | null
default:false
stop
temperature
number | null

Controls randomness in the response. Higher values make output more random. Range: 0-2

Required range: 0 <= x <= 2
top_p
number | null

Nucleus sampling parameter. Controls diversity via nucleus sampling

Required range: 0 <= x <= 1
response_format
ResponseFormatText · object

Optional. Controls the output format. Omit for default text output. Set type to json_schema for structured output.

web_search_options
WebSearchOptions · object
search_mode
enum<string> | null
Available options:
web,
academic,
sec
return_images
boolean | null
enable_search_classifier
boolean | null
disable_search
boolean | null
search_domain_filter
string[] | null
search_language_filter
string[] | null
search_recency_filter
enum<string> | null
Available options:
hour,
day,
week,
month,
year
search_after_date_filter
string | null
search_before_date_filter
string | null
last_updated_before_filter
string | null
last_updated_after_filter
string | null
image_format_filter
string[] | null
image_domain_filter
string[] | null
stream_mode
enum<string>
default:full
Available options:
full,
concise
reasoning_effort
enum<string> | null
Available options:
minimal,
low,
medium,
high
language_preference
string | null

Response

Successful Response

id
string
required
model
string
required
created
integer
required
choices
Choice · object[]
required
usage
UsageInfo · object | null
object
string
default:chat.completion
citations
string[] | null
search_results
ApiPublicSearchResult · object[] | null
images
ImageResult · object[] | null

Array of images returned when return_images is true

Array of related questions returned when return_related_questions is true