Back to Models

GPT-4o

openaiopenai/gpt-4o

API guide

Chat completion

Standard chat or text-in/text-out completion via TheRouter's OpenAI-compatible endpoint.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4o","messages":[{"role":"user","content":"Explain what GPT-4o is in one sentence."}]}'

Vision / image input

GPT-4o accepts image URLs or base64-encoded images alongside text in the chat message.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4o","messages":[{"role":"user","content":[{"type":"text","text":"Describe what is in this image"},{"type":"image_url","image_url":{"url":"https://therouter.ai/assets/vision-sample.png"}}]}]}'

Structured output (JSON)

Use response_format to get GPT-4o to return valid JSON matching a schema β€” ideal for tool calls, data extraction, and parsing.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4o","messages":[{"role":"user","content":"Extract the name, age, and city from: John is 32 and lives in Tokyo."}],"response_format":{"type":"json_object"}}'

Tool / function calling

GPT-4o natively supports tool calling for structured function invocations within the conversation.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4o","messages":[{"role":"user","content":"What is the weather in Tokyo?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]}'

Streaming

Stream partial completions token-by-token for low-latency user experiences.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{"model":"openai/gpt-4o","messages":[{"role":"user","content":"Tell me a short story"}],"stream":true}'
Fact ledger β€” every claim on this page traces here
sourceURLretrieved
Release dateopenai.com β†—2026-05-28verified
Latest snapshotdevelopers.openai.com β†—2026-05-28verified
Training cutoffβ€”β€”single source
Input modalitiesopenai.com β†—2026-05-28verified
Output modalitiesopenai.com β†—2026-05-28verified
Structured output supportplatform.openai.com β†—2026-05-28verified
Max output tokensdevelopers.openai.com β†—2026-05-28verified
Deploymentopenai.com β†—2026-05-28verified
Licenseβ€”β€”verified
MMLUopenai.com β†—2026-05-28verified
HumanEvalopenai.com β†—2026-05-28verified
MMMUopenai.com β†—2026-05-28verified
MATHopenai.com β†—2026-05-28verified
GSM8Kopenai.com β†—2026-05-28verified
GPT-4o retired from ChatGPTopenai.com β†—2026-05-28verified
GPT-4.1 announced as GPT-4o successoropenai.com β†—2026-05-28verified
GPT-4o November 2024 snapshot releasedopenai.com β†—2026-05-28verified
Is GPT-4o still available in the API?openai.com β†—2026-05-28to verify
What is the difference between GPT-4o and GPT-4o Mini?openai.com β†—2026-05-28to verify
Can GPT-4o process audio inputs?openai.com β†—2026-05-28to verify
Is GPT-4o a reasoning model?openai.com β†—2026-05-28to verify
Help & contact