AI & Agents

GPT-4o Token Limit: Context Window, Output Caps & Tier TPM Quotas

The GPT-4o token limit encompasses a 128,000-token total context window, a 16,384-token maximum output ceiling, and usage-tier rate limits ranging from 30,000 to 30,000,000 tokens per minute. While a 128,000-token window accepts around 300 pages of text, heavy prompts and high-resolution vision uploads rapidly deplete per-minute throughput quotas. Offloading reference corpora to indexed workspaces via remote MCP search preserves sequence budgets and prevents 429 rate limit errors.

Tom Langridge 16 min read Updated
The GPT-4o token limit balances a 128,000-token context window against per-minute throughput quotas.

What Governs the GPT-4o Token Limit: Context, Output, and Quotas

Passing an entire codebase or a collection of technical manuals into an API prompt exhausts sequence limits, inflates processing latency, and triggers rate limit throttling. The GPT-4o token limit encompasses a 128,000-token total context window, a 16,384-token maximum output ceiling, and usage-tier rate limits ranging from 30,000 to 30,000,000 tokens per minute. This three-tier operational boundary dictates how much data developers can pass into inference requests, how much text the model can generate in a single turn, and how frequently automated applications can call OpenAI endpoints.

Understanding the distinction between context capacity and throughput limits is critical for engineering teams building autonomous agents, multi-turn conversational systems, and high-volume data extraction pipelines. While technical summaries frequently highlight the 128,000-token figure, production systems rarely fail because of the total context window alone. Instead, production applications hit operational walls when high-resolution images, document attachments, or unmanaged generation buffers exhaust per-minute token quotas. Developers can inspect their live limits in the official OpenAI developer documentation.

The Three Operational Boundaries of GPT-4o

OpenAI separates model boundaries into three distinct functional layers:

  1. Total Context Window (128,000 tokens): The hard sequence capacity shared between developer system instructions, conversation message history, function definitions, tool outputs, and model completions within a single API request.
  2. Maximum Output Generation (16,384 tokens): The maximum number of tokens GPT-4o can autoregressively generate in response to a prompt.
  3. Usage-Tier Throughput Quotas (30,000 to 30,000,000 TPM): The organization-level rate limits that govern how many tokens an application can transmit across rolling 60-second windows.

The following breakdown details the core parameters, allocation constraints, and failure behaviors governing GPT-4o:

Operational Dimension Documented Limit Scope of Enforcement Primary Failure Mode
Total Context Window 128,000 tokens Single API request (input + output) HTTP 400 (context_length_exceeded)
Maximum Output Generation 16,384 tokens Single completion response HTTP 400 (max_tokens parameter out of range)
Low-Detail Image Input 85 tokens Per image object Adds directly to request input tokens
High-Detail Image Input 85 + (170 per tile) tokens Per image object Adds directly to request input tokens
Tier 1 Rate Limit 30,000 TPM / 500 RPM Organization per minute HTTP 429 (rate_limit_exceeded)
Tier 2 Rate Limit 450,000 TPM / 5,000 RPM Organization per minute HTTP 429 (rate_limit_exceeded)
Tier 3 Rate Limit 800,000 TPM / 5,000 RPM Organization per minute HTTP 429 (rate_limit_exceeded)
Tier 4 Rate Limit 2,000,000 TPM / 10,000 RPM Organization per minute HTTP 429 (rate_limit_exceeded)
Tier 5 Rate Limit 30,000,000 TPM / 10,000 RPM Organization per minute HTTP 429 (rate_limit_exceeded)

Developers calling the OpenAI API must balance these three boundaries simultaneously. An application operating within the 128,000-token context ceiling can still fail instantly if a single payload consumes the organization's entire per-minute token allocation.

How Context Window Mechanics Constrain Output Allocation

The GPT-4o context token limit functions as a zero-sum sequence budget. Because OpenAI allocates a shared 128,000-token window for both input processing and autoregressive generation, any token consumed by prompt instructions directly reduces the remaining headroom available for the model's response.

Dynamic Generation Constraints

A common pitfall in agent architecture is assuming that the 16,384-token output limit is always available regardless of input size. In practice, the effective output limit is dynamically constrained by input volume:

Available Output Tokens = min(16384, 128000 - Input Tokens)

If an agent ingests an architectural specification, three schema files, and twenty previous conversational turns totaling 115,000 input tokens, the model cannot generate its full 16,384-token completion. The response is truncated at exactly 13,000 tokens, which is the remainder of the 128,000-token sequence buffer. When generation reaches this boundary, the API halts generation and returns a finish_reason of length.

In early releases of GPT-4o, maximum output was restricted to 4,096 tokens. The introduction of snapshot gpt-4o-2024-08-06 expanded output capacity to 16,384 tokens, as documented in the OpenAI model reference. This expansion unlocked complex tasks, such as generating complete microservice clients or exhaustive financial analyses in a single inference pass. However, when configuring API calls, developers must keep parameter values within valid ranges. In both /v1/chat/completions and /v1/responses, setting the max_tokens or max_completion_tokens parameter higher than 16,384 returns an immediate HTTP 400 Bad Request error.

Tokenizer Compression and the o200k_base Vocabulary

Token consumption in GPT-4o is governed by the o200k_base byte-pair encoding tokenizer. OpenAI expanded the vocabulary from the 100,000 tokens used in GPT-4 Turbo to 200,000 distinct token IDs in GPT-4o. This expansion yields substantial structural benefits:

  • Source Code Density: Code written in Python, TypeScript, Java, and Go tokenizes with higher efficiency. Common syntactic constructs, indentation patterns, and multi-character keywords map to fewer discrete token IDs.
  • Multilingual Efficiency: Languages using non-Latin scripts, including Japanese, Arabic, Korean, and Hindi, demonstrate marked compression gains. Text in these scripts requires substantially fewer tokens compared to earlier tokenizer generations.
  • Structured Data Formatting: JSON keys, YAML spacing, and XML tag syntax require fewer tokens, allowing structured data payloads to fit into smaller sequence budgets.

Despite these tokenizer efficiencies, stuffing large files into prompt contexts remains an expensive anti-pattern. While 128,000 tokens can hold approximately 300 pages of text, running large context prompts incurs linear cost increases and introduces attention degradation over long token sequences.

How Vision Ingestion and Image Processing Consume Tokens

GPT-4o natively accepts visual inputs, including diagrams, user interface screenshots, scanned contracts, and charts. When an application passes an image to the API, OpenAI converts the visual input into token equivalents that draw directly against the request's input token allocation and count toward organization rate limits.

OpenAI provides two image processing modes: low detail and high detail. Understanding the token calculation algorithm for each mode is essential for estimating payload costs and avoiding unexpected quota exhaustion.

Low-Detail Versus High-Detail Calculation

In low detail mode, OpenAI generates a downsampled 512 x 512 pixel representation of the image. Regardless of the original image dimensions or file size, low-detail processing incurs a fixed cost of 85 tokens. This mode is suitable for general scene classification, basic object detection, and identifying primary colors, but it lacks the resolution needed to read technical diagrams or small typography.

In high detail mode, OpenAI applies a multi-step scaling and tiling algorithm designed to preserve high-resolution details:

  1. Bounding Box Rescaling: If either dimension of the original image exceeds 2,048 pixels, the image is scaled down so that its maximum dimension fits within a 2048 x 2048 pixel bounding box, preserving its original aspect ratio.
  2. Shortest-Side Normalization: The image is then scaled such that its shortest side measures exactly 768 pixels.
  3. Tile Grid Partitioning: The scaled image is divided into a grid of 512 x 512 pixel tiles. Any fractional tile along the edges counts as a full 512 x 512 tile.
  4. Token Summation: Each resulting tile costs 170 tokens. A fixed base overhead of 85 tokens is added to the tile total.

The formula for high-detail image token cost is:

Total Image Tokens = 85 + (Tiles Across * Tiles Down * 170)

Real-World Image Token Scenarios

To illustrate how visual assets consume sequence budgets, consider common technical formats:

  • Full HD Screenshot (1920 x 1080 pixels):

    • Initial check: Fits within 2048 x 2048, so no initial downsampling occurs.
    • Rescaling: Shortest side is scaled to 768 pixels. The width scales proportionally from 1920 to 1366 pixels.
    • Tiling: Dividing width 1366 by 512 yields 3 tiles across. Dividing height 768 by 512 yields 2 tiles down.
    • Total tiles: 3 tiles across by 2 tiles down results in 6 tiles. Total token cost is 85 plus 1,020 tokens, totaling 1,105 tokens.
  • Square Product Graphic (1024 x 1024 pixels):

    • Initial check: Fits within 2048 x 2048.
    • Rescaling: Shortest side is scaled to 768 pixels, producing a 768 x 768 pixel square.
    • Tiling: Dividing 768 by 512 yields 2 tiles across by 2 tiles down, creating 4 tiles.
    • Total token cost: 85 plus 680 tokens, totaling 765 tokens.
  • Ultra-Wide System Architecture Banner (3000 x 900 pixels):

    • Initial check: Width exceeds 2048, so the image scales down proportionally to 2048 x 614 pixels.
    • Rescaling: Shortest side is scaled to 768 pixels. The width scales proportionally to 2560 pixels.
    • Tiling: Width 2560 requires 5 tiles across. Height 768 requires 2 tiles down. Total grid equals 10 tiles.
    • Total token cost: 85 plus 1,700 tokens, totaling 1,785 tokens.

When an autonomous agent processes visual documents, such as inspecting 10 application screens or architectural diagrams during a workflow, visual tokens alone consume 8,000 to 18,000 tokens per turn. In high-concurrency environments, repeated visual uploads can quickly exhaust organization throughput allocations.

Why High Context Payloads Trigger 429 Rate Limit Errors

OpenAI enforces rate limits to restrict the frequency and volume of API access across user accounts and client applications. As documented in the OpenAI rate limits documentation:

Rate limits are restrictions that our API imposes on the number of times a user or client can access our services within a specified period of time.

Rate limits are evaluated across three primary metrics: Requests Per Minute (RPM), Requests Per Day (RPD), and Tokens Per Minute (TPM). In agentic workflows and document analysis systems, Tokens Per Minute represents the primary scaling bottleneck.

The Mechanics of Gateway Token Reservation

A frequent source of unexpected HTTP 429 Too Many Requests errors is how the OpenAI API gateway evaluates incoming calls. The gateway does not meter tokens retrospectively after the model finishes generating. Instead, it reserves token capacity before inference begins:

Reserved Request Tokens = Prompt Input Tokens + max(max_tokens, Estimated Completion)

If client code leaves max_tokens configured at its upper limit of 16,384, the API gateway automatically reserves 16,384 tokens plus the prompt's input tokens against the organization's TPM balance for that minute.

Consider an application running on Tier 1 with a 30,000 TPM limit. If a worker sends a request containing 15,000 input tokens and specifies max_tokens: 16384, the gateway attempts to reserve 31,384 tokens. Because 31,384 exceeds the organization's total 30,000 TPM limit, the request fails with an HTTP 429 error immediately. The API rejects the call before generating a single output token, even if the application made no other requests during that minute.

Developer Usage Tier Thresholds

OpenAI groups developer accounts into usage tiers based on cumulative payment history and platform spend. Higher tiers grant higher TPM and RPM allowances for GPT-4o:

Usage Tier Operational Profile GPT-4o RPM GPT-4o TPM Batch Queue Token Limit
Tier 1 Initial account deposit 500 RPM 30,000 TPM 3,000,000 tokens
Tier 2 Account age and initial spend threshold 5,000 RPM 450,000 TPM 20,000,000 tokens
Tier 3 Production scaling tier 5,000 RPM 800,000 TPM 100,000,000 tokens
Tier 4 High-volume deployment tier 10,000 RPM 2,000,000 TPM 500,000,000 tokens
Tier 5 Enterprise platform tier 10,000 RPM 30,000,000 TPM 4,000,000,000 tokens

Under OpenAI's tier structure, these developer limits align with the Build, Launch, and Grow usage tier classifications, which automatically increase per-minute ceilings as organizational usage expands.

Inspecting Rate Limits in API Headers

Applications can dynamically monitor rate limit consumption by inspecting HTTP response headers returned on every API call:

  • x-ratelimit-limit-tokens: The maximum token throughput permitted for the model within a 60-second window.
  • x-ratelimit-remaining-tokens: The remaining token balance available for the current minute.
  • x-ratelimit-reset-tokens: The time remaining until the token quota resets to its full baseline.
  • Retry-After: The number of seconds the client must wait before retrying when a request is throttled with HTTP 429.

Programmatic workflows should read x-ratelimit-remaining-tokens to throttle outgoing request volume and prevent hard 429 exceptions.

Interface illustrating token consumption monitoring, usage quotas, and rate limit tracking
Fastio features

Preserve GPT-4o Token Budgets with Persistent MCP Workspaces

Keep reference documentation and file archives in indexed workspaces where your agents retrieve targeted context over Streamable HTTP. Monthly plans start with a 14-day free trial.

How Remote MCP Workspace Indexing Overcomes Token Ceilings

Direct prompt attachment becomes mathematically unviable as document collections scale. While foundation models support increasingly wide context windows, stuffing source documents into prompts introduces three compounding failure modes: rapid depletion of TPM rate limit quotas, context degradation on long-sequence recall, and elevated operational costs across repetitive turns.

Consumer platforms face parallel physical limits. In Claude, a single chat accepts up to 20 files at 500MB each. In Claude Projects, Anthropic permits an unlimited number of files up to 30MB each, but the cumulative contents must fit within the model's context window. As documented in the Anthropic Help Center:

Number of files: Unlimited, but total content must fit within Claude's context window

Whether developing on Claude or GPT-4o, hitting the context window ceiling forces engineering teams to decouple file storage from active sequence memory.

The Decoupled Architecture: Persistent Workspaces and Remote MCP

Rather than loading whole document archives, code repositories, or PDF sets directly into prompt payloads, production teams store their reference corpus in persistent cloud workspaces and retrieve targeted excerpts dynamically.

Fast.io provides a dedicated cloud workspace platform for agentic teams. By moving heavy file collections into an indexed workspace, agents preserve their sequence headroom and interact with files on demand:

+-------------------------------------------------------------------+
|                        Autonomous AI Agent                        |
+-------------------------------------------------------------------+
                                  |
                                  | Streamable HTTP (MCP)
                                  v
+-------------------------------------------------------------------+
|               Fast.io Remote MCP Server (/mcp/tools)               |
+-------------------------------------------------------------------+
                                  |
                                  | Hybrid Search (Full-Text + Semantic)
                                  v
+-------------------------------------------------------------------+
|             Fast.io Persistent Workspace Storage                  |
|  - Ingested via direct upload or Cloud Sync                      |
|  - Google Drive, Dropbox, Box, and OneDrive synchronization      |
|  - Auto-indexed via Intelligence Mode                             |
|  - Structured field extraction via Metadata Views                 |
+-------------------------------------------------------------------+

Ingestion and Indexing Mechanics

A decoupled workspace architecture operates through four core mechanisms:

  1. Multi-Source Synchronization: Cloud Sync connects Google Drive, Dropbox, Box and OneDrive folders to a workspace, one-way or two-way, on a schedule or on demand. Teams can also upload files directly or import assets via URL without routing data through local machine disks.
  2. Intelligence Mode: Once enabled on a workspace, Intelligence Mode automatically indexes incoming files for hybrid search, combining full-text keyword indexing with semantic vector retrieval.
  3. Structured Document Extraction: For spreadsheets, contracts, and invoices, Metadata Views turn unstructured documents into a live, queryable database. Agents define typed schemas (Text, Integer, Decimal, Boolean, URL, JSON, Date & Time) and extract tabular fields without requiring OCR templates.
  4. Standardized Agent Connectivity: Agents connect to the workspace through the remote Fast.io Model Context Protocol (MCP) server over Streamable HTTP. Assistants and general runtimes connect at https://mcp.fast.io/mcp/tools, ChatGPT and Codex connect via the Fastio plugin or at https://mcp.fast.io/mcp/operations, and coding agents connect at https://mcp.fast.io/mcp/code. Setup details for each client are documented on the Fast.io MCP setup documentation.

Preserving Context Headroom and TPM Budgets

When an agent needs information from a 400-page operational manual or an extensive legal binder, it does not serialize the entire file into the GPT-4o context window. Instead, the agent calls the MCP search action on the storage tool, passing a natural language query:

{
  "method": "tools/call",
  "params": {
    "name": "storage",
    "arguments": {
      "action": "search",
      "query": "liability limitation clause indemnification caps",
      "workspace_id": "ws_enterprise_contracts_2026"
    }
  }
}

The workspace returns only the two or three relevant text passages, complete with source citations, consuming around 600 prompt tokens. The agent answers the user's question accurately while keeping 127,400 tokens of context headroom open and preserving organization TPM quotas. Developers can review Fast.io storage for agents for integration guides.

Monthly plans start with a 14-day free trial, which requires a credit card. Plans are Starter at $9.99/mo, Business at $49.99/mo, and Enterprise at $199.99/mo. Credits meter AI work, and overage is $10 per 100,000 credits. Review full specifications on Fast.io pricing.

Sources

References used to verify factual claims in this guide.

  1. 1 OpenAI Developer Documentation Accessed

    OpenAI documents that GPT-4o operates with a 128,000 context window and can generate up to 16,384 completion output tokens in a single response, while enforcing rate limits that restrict API request frequency and tokens per minute across usage tiers.

  2. 2 Anthropic Help Center Accessed

    Anthropic Claude chat accepts up to 20 files at 500MB each, while Claude Projects permits an unlimited number of files provided total content fits within Claude's context window.

Frequently Asked Questions

What is the token limit for GPT-4o?

The GPT-4o token limit encompasses a 128,000-token total context window per API request, a 16,384-token maximum output generation cap, and usage-tier rate limits ranging from 30,000 to 30,000,000 tokens per minute. All input prompts and generated responses share the 128,000-token sequence allocation.

How many output tokens can GPT-4o generate?

GPT-4o can generate up to 16,384 completion tokens in a single response, provided that input prompt tokens do not exceed 111,616 tokens. Because input and output share the 128,000-token sequence budget, larger prompts dynamically reduce available generation headroom.

What are the tokens per minute (TPM) limits for GPT-4o?

OpenAI enforces GPT-4o TPM limits based on developer usage tiers. Tier 1 accounts are capped at 30,000 TPM, Tier 2 at 450,000 TPM, Tier 3 at 800,000 TPM, Tier 4 at 2,000,000 TPM, and Tier 5 at 30,000,000 TPM. The API gateway evaluates TPM by reserving input tokens plus requested max_tokens before generation begins.

How do high-resolution images calculate token consumption in GPT-4o?

In high-detail mode, GPT-4o scales images within a 2048x2048 bounding box, rescales the shortest side to 768 pixels, and segments the image into 512x512 tiles. Each tile costs 170 tokens, plus an 85-token base overhead. A standard 1080p screenshot consumes 1,105 tokens.

Why does GPT-4o return an HTTP 429 rate limit error when the context window is not full?

OpenAI reserves token throughput at request arrival by summing input prompt tokens and the max_tokens parameter. If this combined total exceeds the organization's remaining per-minute token quota, the API gateway rejects the call with an HTTP 429 error before inference starts.

Does ChatGPT Plus have the same token limits as the GPT-4o API?

No. ChatGPT Plus enforces a conversational message limit of 80 messages every 3 hours for GPT-4o, rather than per-minute token meters. Consumer ChatGPT sessions also deploy automated document chunking and code execution rather than direct raw sequence ingestion.

How does external retrieval over MCP prevent context window exhaustion?

Instead of embedding raw documents into prompts, an external workspace indexes files with hybrid search. An AI agent queries the workspace over Model Context Protocol, retrieving only specific 500-token excerpts with citations. This preserves sequence budgets and protects TPM quotas.

Related Resources

Fastio features

Preserve GPT-4o Token Budgets with Persistent MCP Workspaces

Keep reference documentation and file archives in indexed workspaces where your agents retrieve targeted context over Streamable HTTP. Monthly plans start with a 14-day free trial.