Skip to content

gpt-4o-mini

openai/gpt-4o-mini — a llm model by OpenAI. Call it through the gateway’s standard OpenAI-compatible door using the catalog slug; the full parameter schema is reproduced in full below.

Catalog slugopenai/gpt-4o-mini
Kindllm
VendorOpenAI
Native model idgpt-4o-mini

Through the Sociaro SDK / OpenAI-compatible door

Section titled “Through the Sociaro SDK / OpenAI-compatible door”
from sociaro_ai import Sociaro
client = Sociaro(api_key="gw_live_...") # base_url defaults to https://api.sociaro.com
resp = client.chat.completions.create(
model="openai/gpt-4o-mini", # always the catalog slug
messages=[{"role": "user", "content": "Hello"}],
# any parameter from the schema below is passed through unchanged
)
print(resp.choices[0].message.content)

TypeScript: client.chat.completions.create({ model: "openai/gpt-4o-mini", messages: [...] }) — see the TypeScript SDK.

Optional: send OpenAI’s native request to the /openai prefix, using the native model id gpt-4o-mini. The gateway injects the upstream OpenAI credential and forwards the body unchanged (catalog, pricing and entitlements still apply).

Terminal window
curl https://api.sociaro.com/openai/<native-path> \
-H "Authorization: Bearer $SOCIARO_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "gpt-4o-mini", ... }'

The exact path, request body and response shape are documented in full in the schema below.

The complete, one-to-one API schema for this model, transcribed from the official source. Nothing omitted. Examples in the schema may use a representative model of the family — for this model use the slug openai/gpt-4o-mini (or the native id gpt-4o-mini for the native API) as shown in How to call above.

author slugreasoning model?textimage inputaudio inputaudio outputweb_search_optionsnotes
openai/gpt-4onoyesyes (image_url)nononofull sampling params (temperature/top_p/penalties/logit_bias/logprobs/n/stop)
openai/gpt-4o-mininoyesyes (image_url)nononoidentical request/response shape to gpt-4o
gpt-4o-2024-11-20, gpt-4o-2024-08-06, gpt-4o-2024-05-13noyesyesnononodated gpt-4o snapshots; same contract
gpt-4o-mini-2024-07-18noyesyesnononodated gpt-4o-mini snapshot
gpt-4o-audio-preview*noyesyesyes (input_audio)yes (modalities:[“text”,“audio”] + audio param)noaudio variant
gpt-4o-mini-audio-preview*noyesyesyesyesnoaudio variant
gpt-4o-search-preview*noyesyesnonoyessearch variant; emits message.annotations[url_citation]
gpt-4o-mini-search-preview*noyesyesnonoyessearch variant
chatgpt-4o-latestnoyesyesnononorolling alias

All of the above slugs are part of the model enum of the create method. The same endpoint also serves gpt-4.1, gpt-4-turbo, gpt-3.5-turbo, the o1/o3/o4 reasoning models, and the gpt-5.x family.

Critical per-model differences (within openai-chat)

Section titled “Critical per-model differences (within openai-chat)”
  • Sampling params (temperature, top_p, presence_penalty, frequency_penalty, logit_bias, logprobs/top_logprobs, max_tokens, stop, n) are fully supported by gpt-4o / gpt-4o-mini (non-reasoning). max_tokens is Deprecated in favor of max_completion_tokens (both work on gpt-4o; max_tokens is incompatible with o-series reasoning models).
  • reasoning_effort, verbosity apply to reasoning / newer models; gpt-4o / gpt-4o-mini ignore them. reasoning_effort defaults: medium for all models before gpt-5.1 (which do not support none); none for gpt-5.1 (gpt-5.1 supports none/low/medium/high); gpt-5-pro defaults to and only supports high; xhigh is supported for all models after gpt-5.1-codex-max.
  • stop is NOT supported on the latest reasoning models o3 and o4-mini; works on gpt-4o (up to 4 sequences).
  • Audio output (modalities:["text","audio"] + the audio param) is supported ONLY by gpt-4o-audio-preview / gpt-4o-mini-audio-preview. Plain gpt-4o / gpt-4o-mini emit text only (image accepted on input via image_url).
  • web_search_options is for *-search-preview variants only.
  • Deprecations: user → replaced by safety_identifier + prompt_cache_key; function_call/functions → replaced by tool_choice/tools; seed is Beta and Deprecated; system_fingerprint (response) is Deprecated; max_tokens is Deprecated.
  • prompt_cache_retention default depends on org data-retention policy: orgs without ZDR default to 24h, orgs with ZDR default to in_memory (when unspecified). For gpt-5.5, gpt-5.5-pro, and future models only 24h is supported.

In transparent mode the gateway passes the body through unchanged; this contract is what a client may send to openai/gpt-4o[-mini]. Server-behavior fields (store, metadata, service_tier, moderation) affect OpenAI-side behavior and may be irrelevant/inapplicable through the proxy.

Endpoint: POST https://api.openai.com/v1/chat/completions Headers: Authorization: Bearer $OPENAI_API_KEY, Content-Type: application/json Returns: a chat.completion object (or a stream of chat.completion.chunk objects when stream:true). Parameter support varies by model (see per-model differences above).

The Chat Completions resource also exposes stored-completion management methods (not generation): GET /chat/completions (list), GET /chat/completions/{completion_id} (retrieve), POST /chat/completions/{completion_id} (update), DELETE /chat/completions/{completion_id} (delete). These operate on completions stored via store:true and are not part of the create/generate flow. There is no async create/poll variant for this family — generation is synchronous (or streamed via SSE); the async pattern does not apply.


{
"model": "gpt-4o", // required
"messages": [ /* required */ ], // required, see §2.1
// --- optional generation / behavior params ---
"audio": { "format": "...", "voice": "..." },
"frequency_penalty": 0,
"logit_bias": { "<token_id>": 0 },
"logprobs": false,
"max_completion_tokens": 0,
"max_tokens": 0, // deprecated -> max_completion_tokens
"metadata": { "<key>": "<value>" },
"modalities": ["text"],
"moderation": { "model": "omni-moderation-latest" },
"n": 1,
"parallel_tool_calls": true,
"prediction": { "type": "content", "content": "..." },
"presence_penalty": 0,
"prompt_cache_key": "...",
"prompt_cache_retention": "in_memory" | "24h",
"reasoning_effort": "...", // reasoning models
"response_format": { "type": "text" | "json_object" | "json_schema", ... },
"safety_identifier": "...",
"seed": 0, // beta/deprecated
"service_tier": "auto",
"stop": null,
"store": false,
"stream": false,
"stream_options": { "include_usage": false, "include_obfuscation": true },
"temperature": 1,
"tool_choice": "auto",
"tools": [ /* see §3 */ ],
"top_logprobs": 0,
"top_p": 1,
"user": "...", // deprecated
"verbosity": "medium", // newer models
"web_search_options": { ... }, // *-search-preview
// deprecated
"function_call": "none" | "auto" | { "name": "..." },
"functions": [ { "name": "...", "description": "...", "parameters": {...} } ]
}

nametyperequireddefaultallowed / rangedescription
messagesarray of message objectsyesroles: developer, system, user, assistant, tool, function(deprecated)List of conversation messages. Supported content types (text/image/audio/file) depend on the model. See §2.1.
modelstring (enum)yesincl. gpt-4o, gpt-4o-2024-11-20, gpt-4o-2024-08-06, gpt-4o-2024-05-13, gpt-4o-mini, gpt-4o-mini-2024-07-18, gpt-4o-audio-preview*, gpt-4o-mini-audio-preview*, gpt-4o-search-preview*, gpt-4o-mini-search-preview*, chatgpt-4o-latest, plus gpt-4.1, o1/o3/o4, gpt-5.x, gpt-4-turbo, gpt-3.5-turbo …Model ID used to generate the response.
audioobject {format, voice} (ChatCompletionAudioParam)nosee §2.2Audio-output parameters. Required when audio output is requested via modalities:["audio"].
frequency_penaltynumberno0min -2.0, max 2.0Penalizes tokens by existing frequency in text so far, reducing verbatim repetition.
function_call (Deprecated)string | objectnonone if no functions, else auto"none", "auto", or {"name": "my_function"} (ChatCompletionFunctionCallOption {name})Replaced by tool_choice. Controls which (if any) function is called.
functions (Deprecated)array of object {name, description, parameters}noname: a-z A-Z 0-9 _ -, maxLen 64Replaced by tools. List of functions the model may generate JSON inputs for. Omitting parameters = empty parameter list.
logit_biasmap {token_id: number}nonullbias value -100..100Modifies likelihood of specified tokens. -1..1 nudge; -100/100 effectively ban / force. Effect varies per model.
logprobsbooleannofalsetrue / falseWhether to return log probabilities of output tokens (in content of message).
max_completion_tokensnumbernointeger > 0Upper bound on generated tokens, including visible output AND reasoning tokens.
max_tokens (Deprecated)numbernointeger > 0Max tokens generated in the chat completion. Replaced by max_completion_tokens; not compatible with o-series models.
metadatamap (Metadata)noup to 16 pairs; key ≤64 chars, value ≤512 charsArbitrary key-value pairs for storing/querying extra info via API/dashboard.
modalitiesarray of stringno["text"]members: "text", "audio"Output types the model should generate. ["text","audio"] for audio-capable models (e.g. gpt-4o-audio-preview).
moderationobject {model}nomodel: e.g. omni-moderation-latestConfiguration for running moderation on the request input and generated output.
nnumberno1min 1, max 128How many chat completion choices to generate per input. Billed across all choices; keep 1 to minimize cost.
parallel_tool_callsbooleannotruetrue / falseWhether to enable parallel function calling during tool use.
predictionobject (ChatCompletionPredictionContent) {content, type}notype: "content"Static predicted output (Predicted Outputs), e.g. content of a regenerated file. See §2.3.
presence_penaltynumberno0min -2.0, max 2.0Penalizes tokens by whether they appear in text so far, increasing likelihood of new topics.
prompt_cache_keystringnostringUsed by OpenAI to cache responses for similar requests (optimizes cache-hit rate). Replaces the user field.
prompt_cache_retentionstring (enum)nodepends on org ZDR policy (24h without ZDR; in_memory with ZDR)"in_memory", "24h"Prompt-cache retention policy. 24h = extended caching, prefixes kept active up to 24h. For gpt-5.5 / gpt-5.5-pro / future models only 24h is supported.
reasoning_effortstring (enum)nomodel-dependent (medium pre-5.1; none for gpt-5.1; high for gpt-5-pro)"none", "minimal", "low", "medium", "high", "xhigh"Constrains reasoning effort (reasoning models). Less effort = faster / fewer reasoning tokens. (gpt-5.1 supports none/low/medium/high; xhigh only after gpt-5.1-codex-max.)
response_formatobject (oneOf)no{ "type": "text" }text | json_object | json_schemaOutput format. json_schema = Structured Outputs. See §2.4.
safety_identifierstringnomaxLength 64Stable per-user ID to help detect policy violations. Recommend a hash of username/email.
seed (Deprecated, Beta)numbernomin -9223372036854775808, max 9223372036854775807Best-effort deterministic sampling for same seed+params. Determinism not guaranteed; monitor system_fingerprint.
service_tierstring (enum)no"auto""auto", "default", "flex", "scale", "priority"Processing type. When set, response echoes the service_tier actually used (may differ from the value sent).
stopstring | array of stringnonullup to 4 sequencesStop sequences (excluded from output). NOT supported on latest reasoning models o3 and o4-mini.
storebooleannofalsetrue / falseWhether to store output for model distillation / evals products. Supports text and image inputs (image inputs over 8MB are dropped).
streambooleannofalsetrue / falseStream response data as server-sent events as generated.
stream_optionsobject (ChatCompletionStreamOptions) {include_obfuscation, include_usage}noonly set when stream:trueStreaming options. See §2.5.
temperaturenumberno1min 0, max 2Sampling temperature. Higher = more random, lower = more deterministic. Alter this OR top_p, not both.
tool_choicestring | object (oneOf, ChatCompletionToolChoiceOption)nonone if no tools, else auto"none", "auto", "required"; allowed_tools; named function/customControls which (if any) tool is called. See §3.2.
toolsarray (oneOf: function | custom, ChatCompletionTool)nofunction tools and/or custom toolsTools the model may call. See §3.1.
top_logprobsnumbernointeger min 0, max 20Number of most-likely tokens to return per position (each with logprob). Requires logprobs:true.
top_pnumberno1min 0, max 1Nucleus sampling. 0.1 = only top-10% probability mass considered. Alter this OR temperature.
user (Deprecated)stringnostringStable end-user identifier. Being replaced by safety_identifier + prompt_cache_key (use prompt_cache_key for caching).
verbositystring (enum)nomedium (newer models)"low", "medium", "high"Constrains response verbosity (newer models). Lower = more concise.
web_search_optionsobject {search_context_size, user_location}nosee §2.6Web-search tool for use in the response (*-search-preview models).

Developer message (ChatCompletionDeveloperMessageParam) {content, role:"developer", name?} — instructions the model follows regardless of the user (replaces system on o1+ models).

  • content: string | array of ChatCompletionContentPartText {text, type:"text"} (developer messages support only text parts).
  • role: "developer" (required). name: optional string.

System message (ChatCompletionSystemMessageParam) {content, role:"system", name?} — same purpose as developer, for older models.

  • content: string | array of text parts (only text). role: "system". name: optional.

User message (ChatCompletionUserMessageParam) {content, role:"user", name?} — end-user content.

  • content: string | array of content parts. Part types:
    • ChatCompletionContentPartText {text, type:"text"}
    • ChatCompletionContentPartImage {image_url:{url, detail?}, type:"image_url"}url: image URL or base64 (format: uri); detail: "auto"(default)|"low"|"high".
    • ChatCompletionContentPartInputAudio {input_audio:{data, format}, type:"input_audio"}data: base64; format: "wav"|"mp3".
    • FileContentPart {file:{file_data?, file_id?, filename?}, type:"file"}file_data: base64 file data; file_id: ID of an uploaded file; filename: name when passing as string.
  • role: "user". name: optional.

Assistant message (ChatCompletionAssistantMessageParam) {role:"assistant", audio?, content?, function_call?(deprecated), name?, refusal?, tool_calls?}

  • audio: optional {id} — reference to a previous audio response from the model.
  • content: optional string | array of (ChatCompletionContentPartText {text, type:"text"} | ChatCompletionContentPartRefusal {refusal, type:"refusal"}). Can be one or more text, or exactly one refusal. Required unless tool_calls or function_call is specified.
  • function_call (deprecated): {arguments, name}.
  • refusal: optional string. name: optional string.
  • tool_calls: optional array of:
    • function tool call: {id, function:{arguments, name}, type:"function"}
    • custom tool call: {id, custom:{input, name}, type:"custom"}

Tool message (ChatCompletionToolMessageParam) {content, role:"tool", tool_call_id}

  • content: string | array of text parts. role: "tool". tool_call_id: string (ID of the tool call this responds to).

Function message (Deprecated) (ChatCompletionFunctionMessageParam) {content, name, role:"function"}.

2.2 audio (ChatCompletionAudioParam — request, output config)

Section titled “2.2 audio (ChatCompletionAudioParam — request, output config)”
fieldtyperequiredallowed
formatstring (enum)yes (within object)"wav", "aac", "mp3", "flac", "opus", "pcm16"
voicestring | enum | object {id}yes (within object)built-in voices: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse, marin, cedar; OR a custom voice object, e.g. { "id": "voice_1234" }.

2.3 prediction (ChatCompletionPredictionContent)

Section titled “2.3 prediction (ChatCompletionPredictionContent)”
fieldtyperequiredallowed
contentstring | array of ChatCompletionContentPartText {text, type:"text"}yesThe content to match when generating; if generated tokens match, the response can be returned faster.
typestringyes"content" (currently always content)
  • { "type": "text" } (ResponseFormatText) — default, plain text response.

  • { "type": "json_object" } (ResponseFormatJSONObject) — older JSON mode; requires a system/user instruction to produce JSON.

  • { "type": "json_schema", "json_schema": {...} } (ResponseFormatJSONSchema) — Structured Outputs:

    fieldtyperequiredallowed
    namestringyesa-z A-Z 0-9 _ -, maxLen 64
    descriptionstringno
    schemamap (JSON Schema object)noJSON Schema object
    strictbooleannotrue = strict schema adherence; only a subset of JSON Schema supported when strict is true
    typestringyes"json_schema"

2.5 stream_options (ChatCompletionStreamOptions)

Section titled “2.5 stream_options (ChatCompletionStreamOptions)”
fieldtyperequireddefaultdescription
include_obfuscationbooleannotrue (included by default)Adds random chars to an obfuscation field on streaming delta events to normalize payload sizes (side-channel mitigation). Set false to optimize bandwidth on trusted links.
include_usagebooleannofalseIf set, an extra chunk is streamed before data: [DONE] whose usage field holds whole-request token stats and choices is []. All other chunks carry usage:null. If the stream is interrupted, the final usage chunk may not arrive.
fieldtyperequireddefaultallowed
search_context_sizestring (enum)nomedium"low", "medium", "high"
user_locationobject {approximate, type:"approximate"}noapproximate {city?, country?, region?, timezone?}; country = two-letter ISO; timezone = IANA (e.g. America/Los_Angeles); city/region free text; type always "approximate"

Function tool (ChatCompletionFunctionTool) {type:"function", function:{name, description?, parameters?, strict?}}

fieldtyperequiredallowed
function.namestringyesa-z A-Z 0-9 _ -, maxLen 64
function.descriptionstringno
function.parametersobject (FunctionParameters / JSON Schema)noomitting = empty parameter list
function.strictbooleannotrue = strict schema adherence (Structured Outputs); only a subset of JSON Schema supported when strict
typestringyes"function" (currently only function supported as a tool type here)

Custom tool (ChatCompletionCustomTool) {type:"custom", custom:{name, description?, format?}}

  • custom.name: string (required) — identifies the tool in tool calls.
  • custom.description: optional string.
  • custom.format (oneOf, default = unconstrained text):
    • TextFormat {type:"text"} — unconstrained free-form text.
    • GrammarFormat {type:"grammar", grammar:{definition, syntax}}definition: grammar definition string; syntax: "lark" | "regex".

3.2 tool_choice (oneOf, ChatCompletionToolChoiceOption)

Section titled “3.2 tool_choice (oneOf, ChatCompletionToolChoiceOption)”
  • ToolChoiceMode = "none" | "auto" | "required". (none = no tool, generate a message; auto = model picks; required = must call ≥1 tool.)
  • Allowed tools (ChatCompletionAllowedToolChoice) {type:"allowed_tools", allowed_tools:{mode, tools}}mode: "auto"|"required"; tools: array of tool definition maps, e.g. [{ "type":"function", "function":{ "name":"get_weather" } }].
  • Named function (ChatCompletionNamedToolChoice) {type:"function", function:{name}}.
  • Named custom (ChatCompletionNamedToolChoiceCustom) {type:"custom", custom:{name}}.

Default: none when no tools present, auto when tools present.


{
"id": "string",
"object": "chat.completion",
"created": 1741569952, // unix time
"model": "gpt-4o-...",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "string|null",
"refusal": "string|null",
"annotations": [ { "type": "url_citation", "url_citation": {...} } ],
"audio": { "id", "data", "expires_at", "transcript" }, // if audio output
"tool_calls": [ ... ],
"function_call": { "arguments", "name" } // deprecated
},
"logprobs": { "content": [...], "refusal": [...] } | null,
"finish_reason": "stop"
}
],
"usage": { ... },
"service_tier": "default",
"system_fingerprint": "string", // deprecated
"moderation": { "input": {...}, "output": {...} } // if moderated completions requested
}
fieldtypedescription
idstringUnique identifier for the chat completion.
choicesarrayList of choices (>1 if n>1).
choices[].finish_reasonenum"stop", "length", "tool_calls", "content_filter", "function_call"(deprecated).
choices[].indexnumberIndex of the choice in the list.
choices[].logprobsobject | null{content[], refusal[]}; each item is a ChatCompletionTokenLogprob {token, bytes[](nullable), logprob, top_logprobs[]}; top_logprobs[] entries are {token, bytes[], logprob}; logprob = -9999.0 if outside top-20.
choices[].message.contentstringMessage contents.
choices[].message.refusalstringRefusal message generated by the model.
choices[].message.role"assistant"Role of the author.
choices[].message.annotationsarray{type:"url_citation", url_citation:{end_index, start_index, title, url}} (present when using web search).
choices[].message.audioobject{id, data(base64), expires_at(unixtime), transcript} (if audio output modality requested).
choices[].message.function_call (deprecated)object{arguments, name}.
choices[].message.tool_callsarrayfunction: ChatCompletionMessageFunctionToolCall {id, function:{arguments, name}, type:"function"}; custom: ChatCompletionMessageCustomToolCall {id, custom:{input, name}, type:"custom"}.
creatednumberUnix timestamp (seconds) of creation.
modelstringModel used for the completion.
object"chat.completion"Object type (always chat.completion).
service_tierenumTier actually used: auto/default/flex/scale/priority.
system_fingerprint (Deprecated)stringBackend-configuration fingerprint (use with seed to detect backend changes).
moderationobject{input, output} (present if moderated completions were requested). Each side is ModerationResults {model, results[], type:"moderation_results"} OR Error {code, message, type:"error"}. Each entry in results[] is {categories(map[bool]), category_applied_input_types(map[array of "text"/"image"]), category_scores(map[number]), flagged(bool), model(string), type:"moderation_result"}.
usageobject (CompletionUsage)Token usage statistics; see §4.2.
fieldtypedescription
completion_tokensnumberTokens in the generated completion.
prompt_tokensnumberTokens in the prompt.
total_tokensnumberTotal = prompt + completion.
completion_tokens_detailsobject{accepted_prediction_tokens?, audio_tokens?, reasoning_tokens?, rejected_prediction_tokens?}. accepted_prediction_tokens / rejected_prediction_tokens = Predicted-Outputs hits/misses (rejected still billed); reasoning_tokens = tokens spent on reasoning; audio_tokens = audio tokens generated by the model.
prompt_tokens_detailsobject{audio_tokens?, cached_tokens?}. audio_tokens = audio input tokens in the prompt; cached_tokens = cached tokens in the prompt.

4.3 Streaming chunk (chat.completion.chunk)

Section titled “4.3 Streaming chunk (chat.completion.chunk)”

When stream:true, the response is a stream of chat.completion.chunk objects carrying choices[].delta (incremental) instead of choices[].message. With stream_options.include_usage:true, a final chunk before data: [DONE] carries the whole-request usage and choices = []; all other chunks carry usage: null.


Request

Terminal window
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [
{ "role": "developer", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Hello!" }
]
}'

Response

{
"id": "chatcmpl-B9MBs8CjcvOU2jLn4n570S5qMJKcT",
"object": "chat.completion",
"created": 1741569952,
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?",
"refusal": null,
"annotations": []
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 19,
"completion_tokens": 10,
"total_tokens": 29,
"prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 },
"completion_tokens_details": {
"reasoning_tokens": 0, "audio_tokens": 0,
"accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0
}
},
"service_tier": "default"
}

Streaming (stream:true) — stream of chunks:

{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini","system_fingerprint":"fp_44709d6fcb","choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]}
{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini","system_fingerprint":"fp_44709d6fcb","choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]}
{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini","system_fingerprint":"fp_44709d6fcb","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]}

6. FULL examples (vision + tools + structured-style options + audio)

Section titled “6. FULL examples (vision + tools + structured-style options + audio)”

Vision (image input) — request

Terminal window
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "What is in this image?" },
{ "type": "image_url",
"image_url": { "url": "https://.../boardwalk.jpg", "detail": "auto" } }
]
}
],
"max_tokens": 300
}'

Function calling — request

Terminal window
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [
{ "role": "user", "content": "What is the weather like in Boston today?" }
],
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" },
"unit": { "type": "string", "enum": ["celsius", "fahrenheit"] }
},
"required": ["location"]
},
"strict": true
}
}
],
"tool_choice": "auto",
"parallel_tool_calls": true,
"temperature": 0.7,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0,
"n": 1,
"stop": null,
"max_completion_tokens": 512,
"response_format": { "type": "text" },
"logprobs": true,
"top_logprobs": 5,
"seed": 42,
"store": false,
"metadata": { "session": "abc" },
"service_tier": "auto",
"stream": false,
"prompt_cache_key": "user-123"
}'

Function calling — response

{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1699896916,
"model": "gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_current_weather",
"arguments": "{\n\"location\": \"Boston, MA\"\n}"
}
}
]
},
"logprobs": null,
"finish_reason": "tool_calls"
}
],
"usage": {
"prompt_tokens": 82,
"completion_tokens": 17,
"total_tokens": 99,
"completion_tokens_details": {
"reasoning_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
}
}

Structured Outputs — response_format with json_schema (request fragment)

"response_format": {
"type": "json_schema",
"json_schema": {
"name": "weather",
"description": "structured weather",
"strict": true,
"schema": {
"type": "object",
"properties": { "temp_c": { "type": "number" } },
"required": ["temp_c"],
"additionalProperties": false
}
}
}

Audio output (audio variant model) — request fragment

{
"model": "gpt-4o-audio-preview",
"modalities": ["text", "audio"],
"audio": { "voice": "alloy", "format": "wav" },
"messages": [ { "role": "user", "content": "Is a golden retriever a good family dog?" } ]
}

Audio input (audio variant model) — user message content part

{
"role": "user",
"content": [
{ "type": "text", "text": "Transcribe and answer this." },
{ "type": "input_audio", "input_audio": { "data": "<base64>", "format": "mp3" } }
]
}