Skip to Content
ModelsGPTOverview

GPT family

OpenAI’s GPT text models, including the GPT-6, GPT-5.x, GPT-4.1, GPT-4o and Codex series. They are called through the OpenAI-compatible API, which supports both Chat Completions and Responses; the official OpenAI SDK works once you change base_url.

Common tasks

Models

All models support tool calling and structured output; all except GPT-5 nano accept image input. For the full model list and live prices, see the model page , or query the Models API.

Common model IDs (copy them exactly)
GPT-6 Solopenai/gpt-6-sol
GPT-5.4openai/gpt-5.4
GPT-5.4 miniopenai/gpt-5.4-mini
GPT-4.1 miniopenai/gpt-4.1-miniNo reasoning; suited to simple tasks

You can omit the openai/ prefix, e.g. gpt-5.4. The model field in responses always includes the prefix.

Choosing an endpoint

Key pointThe Codex series and GPT-5.4 Pro support only the Responses API; all other models work with both.
Chat CompletionsResponses
EndpointPOST https://api.ofox.io/v1/chat/completionsPOST https://api.ofox.io/v1/responses
Inputmessagesinput (a string or an array of messages)
Output limitmax_completion_tokens (max_tokens also accepted)max_output_tokens
Reasoning effortreasoning_effortreasoning.effort
Reasoning summaryNot returnedreasoning.summary — see Reasoning summaries
Web searchNot supportedweb_search tool
Models available only here—openai/gpt-5.4-pro, openai/gpt-5.3-codex, openai/gpt-5.2-codex

For the full request parameters, see the Chat Completions API and the Responses API.

Providers

ProviderModels
Azure AI Foundry (azure_foundry)All models; default provider
OpenAI (openai)GPT-6 Sol, GPT-6 Luna, GPT-6 Astra, GPT-5.6 Sol, GPT-5.6 Terra, GPT-5.6 Luna

In our tests, both providers behaved the same for reasoning, caching and web search. To select a provider, add the X-OfoxAI-Provider-Type: openai request header; for other methods, see Provider routing.

Examples

gpt_chat.py
import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.io/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.chat.completions.create( model="openai/gpt-5.4", messages=[ {"role": "system", "content": "You are a senior backend engineer. Keep answers concise."}, {"role": "user", "content": "Explain idempotency in one sentence."}, ], ) print(resp.choices[0].message.content)

Prompt caching

Key pointThe GPT family caches automatically with no changes to your request. Put fixed content at the start of the request to improve the hit rate.

When a request’s prefix matches a recent request and is long enough, it hits the cache automatically, and the cached portion is billed at the cache read rate.

ItemDetails
Confirming hitsIn Chat Completions, usage.prompt_tokens_details.cached_tokens is greater than 0; in Responses, usage.input_tokens_details.cached_tokens
WritesThe GPT-6 and GPT-5.6 series return prompt_tokens_details.cache_write_tokens on the first request, billed at the cache write rate
Minimum lengthPrefixes that are too short are not cached; for the minimum length, see the OpenAI docs 
ReliabilityCaching is best-effort; requests with the same prefix may still miss

For general information on caching, see Prompt caching.

Add web_search to tools on the Responses API, and the model runs searches on its own and cites sources. Chat Completions does not support web search.

gpt_web_search.py
import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.io/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.responses.create( model="openai/gpt-5.4", tools=[{"type": "web_search"}], input="What is the latest stable version of Python?", ) print(resp.output_text) print("Searches:", sum(1 for item in resp.output if item.type == "web_search_call"))

Each web_search_call item in output is one search, and the message item is the final answer. Searches are billed per use; see the model page  for the rate.

Common errors

Key pointParameter errors return 400 with a reason. Long reasoning occasionally causes 502 or 504; use streaming and set a long timeout.
HTTP · typeError messageCauseFix
400 invalid_request_errorThis model's maximum context length is 128000 tokens. However, your messages resulted in 152008 tokens.Input exceeds the model’s context windowShorten the input, or switch to a model with a longer context
400 invalid_request_errormax_tokens is too large: 100000. This model supports at most 16384 completion tokensOutput limit exceeds the model’s maximumLower max_completion_tokens
400 invalid_request_errorInvalid value: 'bogus'. Supported values are: 'low', 'medium', 'high', and 'xhigh'.The reasoning_effort value is not supported by this modelUse one of the values listed in the error message
400 endpoint_not_supportedModel 'openai/gpt-5.4-pro' does not support the /v1/chat/completions endpoint on this platform.The model supports only the Responses APIUse /v1/responses
404 model_not_foundModel 'openai/gpt-9' not foundModel ID misspelled, or the model has been retiredCopy the model ID from this page
429 rate_limit_errorRate limit reached for the requested model. Please retry after a short delay.Too many requestsRetry later — see Rate limits
502 upstream_errorThe model service is temporarily unavailable. Please retry or switch to another model.Upstream service temporarily unavailableRetry later, or switch to another model
504 gateway_timeoutThe upstream service did not respond in time.Reasoning took too long and upstream did not respond in timeUse streaming, or lower the reasoning effort
200, finish_reason: "length" with an empty answer—Reasoning used up max_completion_tokensIncrease max_completion_tokens, or lower the reasoning effort

For other general errors, see Error Handling.

Official docs

The official docs describe behavior when calling OpenAI directly. When calling through OfoxAI, model IDs and endpoints on this page take precedence.

FAQ

How do I write a GPT model ID?

The standard format is openai/gpt-5.4. You can also omit the openai/ prefix and write gpt-5.4.

Should I use Chat Completions or Responses?

Either works. The Codex series and GPT-5.4 Pro support only Responses, and you also need Responses for reasoning summaries or web search. Projects with existing Chat Completions code can keep using it.

How do I enable reasoning for GPT?

In Chat Completions, pass reasoning_effort (e.g. "high"); in Responses, pass reasoning: {"effort": "high"}. Some models do not reason by default, so pass it explicitly when you need it.

Why is the GPT response empty with finish_reason length?

Reasoning tokens count toward max_completion_tokens, and once reasoning uses up the budget no answer is produced. Increase max_completion_tokens or lower reasoning_effort.

What does the error does not support the /v1/chat/completions endpoint mean?

The model supports only the Responses API, e.g. gpt-5.4-pro, gpt-5.3-codex and gpt-5.2-codex. Use POST /v1/responses instead.

Can I see the GPT reasoning process?

Use the Responses API and pass reasoning: {"effort": "medium", "summary": "auto"}; the reasoning items in output will contain a reasoning summary. Chat Completions does not return reasoning content.

Can GPT search the web?

Yes. Use the Responses API and add {"type": "web_search"} to tools. Chat Completions does not support web search.

Do I need to enable GPT prompt caching manually?

No. When the prefix is long enough and matches a recent request, it hits the cache automatically; the cached amount is in cached_tokens in usage.

What should I do if GPT requests time out or return 504?

High-effort reasoning can take a long time. Use streaming (stream: true), set the client timeout to 600 seconds or more, or lower reasoning_effort.

Last updated on