Create a chat
BazaarLink returns a standardized response and removes upstream-specific fields. usage.cost is the USD amount charged to the customer for this request. Use the opaque BazaarLink request id from the response id or x-request-id with GET /v1/generation; non-streaming responses also return it in x-generation-id. Stats may take a few seconds after completion; retry a 404 briefly. Long non-streaming Chat, Messages, and Responses requests (about 12 seconds or longer) may start with whitespace keep-alive padding before the JSON body. Standard JSON parsers accept leading whitespace. Audio chat uses this endpoint; request audio output with modalities:["text","audio"] and audio:{voice,format}. GET /v1/models?output_modalities=audio filters audio output only, not all audio-input models; audio-input models producing text remain in the text list. Capability metadata alone does not guarantee an available route; select a listed model and its supported parameters. Audio-only output, TTS, STT, and other non-token generation modes are outside this contract.
/v1/chat/completionsAuthorizations
AuthorizationrequiredAPI key as bearer token in the Authorization header.
Body
modelrequiredThe model to use, provider-qualified, e.g. "openai/gpt-4o". GET /v1/models lists ids such as "claude-sonnet-4.6" and canonical aliases such as "anthropic/claude-sonnet-4.6". Requests accept either form; use a listed id or alias.
"openai/gpt-4o"messagesrequiredArray of conversation messages, at least one. Each has a role (system/user/assistant/tool) and content.
contentPut audio input in messages[].content[]: {"type":"input_audio","input_audio":{"data":"<raw base64>","format":"wav"}}. Use raw base64, not a data URI; formats depend on the model. Do not use top-level input_audio: it has no dedicated validation or credit-reservation contract.
[{"type":"input_audio","input_audio":{"data":"<raw base64>","format":"wav"}}]modelsFallback model list — tried in order, only used once the primary model's own candidate group is exhausted.
streamtrue streams the response as SSE; omitted or false returns a single JSON response. Audio streams return data (base64 audio) and transcript fragments in choices[].delta.audio; non-streaming responses use choices[].message.audio. The model may also provide id and expires_at. Accumulate fragments and decode using audio.format; streaming formats depend on the model.
temperatureSampling temperature — higher is more random, lower is more deterministic. Sampling values are forwarded without range validation; the model may clamp or ignore values outside its supported range.
max_tokensMaximum number of tokens the response may generate.
max_completion_tokensAlias of max_tokens with identical semantics.
top_pNucleus sampling threshold.
top_kLimits sampling to the K highest-probability tokens.
frequency_penaltyPenalizes tokens based on how often they've already appeared.
presence_penaltyPenalizes tokens based on whether they've appeared at all, regardless of count.
repetition_penaltyRepetition penalty coefficient — a separate mechanism from frequency/presence penalty.
min_pMinimum probability threshold relative to the most likely token.
top_aAnother dynamic-cutoff sampling mechanism, scaling the threshold by the square of the top probability.
seedDeterministic sampling seed; not all providers guarantee reproducibility.
nNumber of completions to generate.
stopSequences where generation stops, up to 4.
toolsList of tool/function definitions the model may call.
tool_choiceControls whether/how the model is forced to call a tool.
parallel_tool_callsWhether to allow parallel tool calls when tools are provided. Default true. OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
response_formatConstrains the output format, e.g. {type:"json_object"} or {type:"json_schema"} with a JSON Schema.
logit_biasMaps token IDs to bias values [-100, 100] added before sampling. OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
logprobsReturn log probabilities of each output token. OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
top_logprobsNumber of most-likely tokens to return per position (requires logprobs: true). OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
userEnd-user identifier for monitoring and abuse detection. Has no effect on billing. OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
reasoningReasoning-model thinking control object (e.g. {effort, max_tokens}).
reasoning_effortFlat shorthand for reasoning.effort.
lowmediumhighinclude_reasoningtrue returns the thinking text in message.reasoning (delta.reasoning when streaming); false turns thinking off for the models that think by default (see the reasoning section), so no thinking is billed. Without reasoning_effort, reasoning or thinking, only those models think and return it by default; other models return it only when asked.
image_configImage generation/edit options (used when modalities includes image).
modalitiesRequested output modalities. Including image routes through the image-generation dispatch path. Audio chat uses ["text","audio"] with an audio object and requires a model supporting text and audio output.
textimageaudio["text","audio"]audioAudio output options with modalities:["text","audio"]. Supported voice and format values depend on the model.
{"voice":"alloy","format":"wav"}voiceA voice supported by the model, for example alloy.
"alloy"formatAn output format supported by the model, for example wav; streaming commonly uses pcm16, subject to model support.
"wav"pluginsArray of plugins (e.g. {id:"web"} to enable web search). Supported only on some model routes, with no effect elsewhere; :online enables web search on supported routes. Web search requested through plugins, :online, or web_search_options may incur an upstream add-on charge on the key used: BazaarLink's platform key or your BYOK key.