OpenAI model behaviour
How OpenAI's models and API actually behave at the edges: context and output limits, caching thresholds, streaming event shapes, and the parameters whose documented meaning differs from the obvious reading.
The OpenAI API is easy to start with and surprising to operate. Most of the surprises are not bugs; they are documented behaviours whose obvious reading is wrong. max_tokens is not a length target, it is a guillotine. seed does not buy determinism, it buys an attempt at it. A context window is not a budget for your prompt, it is a budget your prompt shares with an answer — and, on the reasoning models, with thinking you are billed for and never see.
These pages take one such edge each and explain the mechanism behind it, with the figure sourced to OpenAI’s own reference and dated where it is expected to move. They are written for the moment you are staring at a truncated JSON object, a bill that is four times the length of the answer, or a streaming chunk with a field you did not expect — and want to know why, not just what to type instead.
GPT-4o's Context Window: What 128K Actually Buys You
The documented 128,000-token window, what share of it your prompt can really use, and how many pages of English that works out to when you show the ratio.
8 min read
GPT-4o's Max Output Tokens, and What Happens When You Hit It
The documented per-response cap on GPT-4o, why max_completion_tokens replaced max_tokens, and exactly what a response truncated mid-JSON looks like.
8 min read
o1's Context Window and the Reasoning Tokens Eating Into It
How o1's 200,000-token window is divided between prompt, invisible reasoning and visible answer, and why a large max_completion_tokens is a requirement rather than a precaution.
9 min read
The Developer Role in the OpenAI API, and How It Differs From System
Why OpenAI renamed the system role to developer for its reasoning models, what the instruction hierarchy means by it, and what actually changes in your request payload.
8 min read
OpenAI's Stop Parameter: Four Sequences, Then What
The documented four-sequence cap on stop, the error envelope a fifth produces, and why the stop string never appears in the text you get back.
8 min read
The Shape of a Parallel Tool Call Response in the OpenAI API
The tool_calls array a model returns when it wants several functions at once, annotated field by field, plus the message sequence you must send back.
9 min read
Strict Mode in OpenAI Function Calling: What It Rejects
The JSON Schema subset strict mode enforces, the three schema shapes it rejects outright, and what the guarantee does and does not cover.
9 min read
The Shape of an OpenAI Streaming Chunk, Delta by Delta
A complete SSE stream read in order, showing where role, content, finish_reason and usage each appear and what a correct accumulator has to handle.
9 min read
The Seed Parameter and What “Mostly Deterministic” Means
Why OpenAI describes seeded sampling as best-effort, what system_fingerprint is for, and the three sources of non-determinism a seed cannot remove.
8 min read
GPT-4o Image Input: Resolution, Tiling and the Token Cost Before You Send
OpenAI's documented resizing and tiling rules for image input, applied to three real image sizes with the arithmetic shown at each step.
9 min read
Audio Input in the GPT-4o Realtime API
The audio formats the Realtime API accepts, how audio is appended to and committed from the input buffer, and which events mark a turn.
9 min read
Reasoning Tokens: Why o1 Bills for Text You Never See
Where reasoning tokens appear in the usage object, how they are priced, and a worked invoice showing why the bill can be ten times the length of the answer.
9 min read
Does o1 Support a System Message? What the Docs Actually Say
Why an o-series request rejects a system role, which snapshots accept the developer role instead, and how to rewrite the message without losing the instruction.
8 min read
OpenAI's Model Deprecation and Shutdown Schedule
What OpenAI's deprecations page actually commits to, the difference between a deprecated model and a shut-down one, and what each state does to a live request.
8 min read
Pinning a Dated OpenAI Model Snapshot Instead of an Alias
How to find out which dated snapshot an alias resolves to, swap it into your requests, and verify the pin held.
9 min read
cl100k_base and o200k_base: Why GPT-4o's Token Counts Changed
What changed between the two tiktoken encodings, why the same string costs a different number of tokens on GPT-4o than on GPT-4, and which of your numbers were computed with the wrong one.
8 min read
How Many Images Fit in a Single GPT-4o Request
The binding constraint on images per request is the context window and the documented per-image token cost, and this page does the arithmetic for both detail settings.
8 min read
logprobs and top_logprobs in the OpenAI API: Which Models Return Them
How the two parameters interact, the exact shape of the logprobs object that comes back, which model families expose it, and how to turn a log probability into a usable confidence number.
8 min read
Structured Outputs in GPT-4o: Strict JSON Schema End to End
A normal JSON Schema next to the strict-mode version of the same schema, with each required transformation explained and the two failure modes that survive strict mode.
9 min read
GPT-4o-mini's Context Window and Output Cap
The documented context window and maximum output tokens, why they are two different limits, and what a full-window request costs at the published rates.
8 min read
Automatic Prompt Caching in the OpenAI API: The 1,024-Token Floor
The documented minimum prefix length, the 128-token increments above it, and a request that qualifies for caching next to one that does not.
8 min read
GPT-4 Turbo's Knowledge Cutoff Date, and What It Means in Practice
The documented cutoff for each GPT-4 Turbo snapshot, why the model's knowledge thins out well before that date, and the three questions the cutoff does not answer.
8 min read
The Moderation Endpoint and Why the Model Still Refuses on Its Own
Moderation is a separate classifier you call yourself; the chat model's refusal comes from its own training. Neither one knows the other's verdict.
8 min read
Temperature and top_p Together in the OpenAI API: What Changing Both Does
Why OpenAI's reference tells you to alter one or the other, worked through on a five-token distribution where changing temperature silently changes what top_p removes.
9 min read
The n Parameter: Multiple Completions in One OpenAI Request
What the choices array looks like when n is greater than one, how the bill splits between a prompt charged once and completions charged n times, and where n is not available.
8 min read
finish_reason Values in the OpenAI API and What Each One Means
Every documented value of finish_reason on a chat completion, the condition that produces it, and what your code has to do differently for each.
9 min read
frequency_penalty and presence_penalty in the OpenAI API: What Each One Changes
The two penalty formulas from OpenAI's reference, applied to a token that has already appeared eight times, so you can see what a value of 0.5 does in probability terms.
9 min read
system_fingerprint in the OpenAI API and What It's For
The field exists to tell you when the backend behind a model name changed, which is the missing half of what the seed parameter promises.
8 min read
Does o1-mini Support Function Calling?
No, and the 400 you get names the parameter — here is the error, the rest of the capability gap it belongs to, and the four ways round it.
8 min read
response_format json_schema: How OpenAI's Structured Output Type Works
A complete request built from scratch, the strict-mode subset of JSON Schema the API will accept, and the two response fields that are not your parsed object.
10 min read
The Streaming Event Shape of the OpenAI Realtime API
The envelope every Realtime event shares, the client events you send, the server event families you receive, and the ordering that a session walkthrough makes concrete.
10 min read
How OpenAI Counts Tokens in a Multi-Turn Conversation With Tool Results
The per-message overhead OpenAI publishes, applied across a five-request conversation with a tool call, showing why one 120-token tool result gets billed four times.
10 min read
GPT-4.1's Context Window and Why It Differs From GPT-4o's
The documented context and output limits for GPT-4.1 set beside GPT-4o's from the same source, and the three limits that stop you using the larger one.
9 min read
OpenAI's max_tokens Default and Why Omitting It Truncates Output
Truncated output with no max_tokens set has three different causes depending on the endpoint and the model, and only one of them is the classic default of 16.
9 min read
Other topics
- LLM fundamentals & architecture
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Flaky tests against a model
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Building an extraction pipeline
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Hallucination & failure modes
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- Claude model behaviour
- Gemini model behaviour
- Llama model behaviour
- Mistral model behaviour
- Qwen model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Grok model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models