OpenAI Assistants API Pricing Explained
The Assistants API lets you build AI agents that keep memory, run code, and search files without you having to manage conversation state yourself. While it’s convenient, the pricing model can surprise new users because costs are tied to token usage plus separate fees for the built‑in tools. This guide breaks down every charge, shows realistic cost examples, and offers actionable ways to keep your bill predictable—especially important now that the Assistants API is set to retire on August 26 2026.
How the Assistants API Bills You
At its core, the Assistants API does not add its own surcharge on top of the model you choose. You pay the standard OpenAI token rates for the model powering the assistant (e.g., GPT‑5 Mini, GPT‑5 Nano, GPT‑5.4, etc.). Those rates cover:
- Input tokens – everything you send (system instructions, conversation history, tool outputs you feed back, retrieved context).
- Output tokens – the model’s reply, including any reasoning tokens that are billed as output even if they aren’t shown in the final text.
- Cached input – when the same prompt prefix appears repeatedly, OpenAI bills those tokens at roughly 10 % of the regular input rate. No code changes are needed; just keep static content (system prompt, long instructions) at the start of your message array.
- Batch API – for non‑real‑time workloads you can cut input and output costs in half by using the asynchronous Batch endpoint (up to a 24‑hour turnaround).
Key point: If you use the Assistants API with a model that costs $5 / $30 per million input/output tokens, that’s exactly what you’ll be charged for the tokens the model sees. The API itself is free; the cost comes entirely from the underlying model and any optional tools you enable.
Token Consumption and Thread History
One of the biggest cost drivers is how the Assistants API handles conversation threads. When you create a thread, every message you add is stored on OpenAI’s servers. Each time you trigger a run, the assistant receives the entire thread (system prompt + all prior messages + your latest user input) unless you manually trim it. Consequently, you are billed for all those tokens on every run, even though you only sent one new message.
Why costs can creep up
Imagine a simple support bot:
| Turn | New user message (tokens) | Thread size before run (tokens) | Tokens billed for this run |
|---|---|---|---|
| 1 | 80 | 80 (system + user) | ~200 |
| 2 | 80 | 260 | ~340 |
| 3 | 80 | 440 | ~520 |
| … | … | … | … |
Each turn adds the previous history to the bill, so after 100 turns you could be paying for tens of thousands of tokens per request even though the fresh user input is tiny. Left unchecked, monthly spend can balloon quickly.
Controlling thread‑related costs
- Trim history – keep only the most recent N messages or enforce a maximum token window before each run.
- Summarize older turns – replace long histories with a brief summary that fits within your token budget.
- Set
max_tokenson the model call to limit how much context the model will actually process (though note that the assistant still receives the full thread; trimming is essential). - Use cached input for a large, unchanging system prompt so that the bulk of the thread is cheap after the first few runs.
Tool‑Specific Charges
Enabling the built‑in tools adds predictable line‑item fees on top of token costs.
| Tool | How you’re billed | Typical price (2024‑2026) |
|---|---|---|
| Code Interpreter | Per session (a session lasts up to one hour of active use) | $0.03 / session (default memory container). Larger memory configurations increase the fee proportionally. |
| File Search (vector store) | Storage: $0.10 / GB / day (first GB free per assistant).<br>Tool calls: $2.50 / 1 000 calls. | Storage scales with the size of your knowledge base; each search call incurs the per‑call fee. |
| Web Search (if you enable the preview tool) | $10 / 1 000 calls plus the token cost of any retrieved snippets that are fed into the model. | Useful for up‑to‑date info, but each call can become expensive if you pull large chunks. |
| Containers (when you run Code Interpreter with custom memory/CPU) | Hourly reservoir pricing based on GB‑hour usage (e.g., $0.03 / GB‑hour for a 1 GB container). | Most users stay with the default container, which is already covered by the per‑session fee. |
Note: The Assistants API does not charge extra for storing thread messages themselves; you only pay for the tokens those messages generate when the model runs.
Real‑World Cost Examples
Below are three illustrative scenarios using 2025‑2026 pricing (standard, non‑batch rates). Adjust the numbers to match your own traffic and model choice.
1. Simple FAQ Chatbot
- Model: GPT‑5 Mini – $0.25 input / $2.00 output per M tokens
- Volume: 100 000 messages/month
- Average tokens: 1 000 input + 250 output (75 %/25 % split)
- Monthly token cost:
- Input: 100 000 × 1 000 ÷ 1 000 000 × $0.25 = $25
- Output: 100 000 × 250 ÷ 1 000 000 × $2.00 = $50
- Total: ≈ $75
- Tool usage: None (pure text).
- Optimization tip: Enable prompt caching for a 500‑token system prompt → input cost drops ~90 % for that portion.
2. Data‑Analysis Assistant (Code Interpreter)
- Model: GPT‑5 – $1.25 input / $10.00 output per M tokens
- Volume: 2 000 runs/month (each run triggers a code session)
- Average tokens per run: 1 500 input + 500 output
- Token cost:
- Input: 2 000 × 1 500 ÷ 1 000 000 × $1.25 = $3.75
- Output: 2 000 × 500 ÷ 1 000 000 × $10.00 = $10.00
- Subtotal: $13.75
- Code Interpreter sessions: 2 000 × $0.03 = $60
- Monthly total: ≈ $73.75
- Optimization tip: Batch multiple independent analyses into a single session when possible, or switch to the Batch API for offline jobs to halve token costs.
3. Document Q&A Bot with File Search
- Model: GPT‑5.4 – $2.50 input / $15.00 output per M tokens
- Volume: 50 000 queries/month
- Average tokens: 800 input + 200 output
- Token cost:
- Input: 50 000 × 800 ÷ 1 000 000 × $2.50 = $100
- Output: 50 000 × 200 ÷ 1 000 000 × $15.00 = $150
- Subtotal: $250
- File Search storage: 5 GB of PDFs → 5 GB × $0.10 / GB‑day × 30 days = $15 (first GB free, so actually 4 GB × $0.10 × 30 = $12)
- File Search tool calls: Assume 2 calls per query → 100 000 calls → 100 × $2.50 = $250
- Monthly total: ≈ $512
- Optimization tip:
- Prune or summarize documents to lower storage GB.
- Cache frequent search results in your own layer to cut tool calls.
- Consider a smaller model (GPT‑5 Mini) if answer quality permits.
These examples show that tool fees can quickly rival or exceed token costs, especially when you make many calls or store large knowledge bases.
Cost‑Optimization Checklist
- Trim or summarize threads – keep only what the model truly needs for each run.
- Leverage prompt caching – place static instructions, long system prompts, or retrieved context at the start of the message array to benefit from the ~90 % discount on repeated prefixes.
- Pick the right model – start with GPT‑5 Nano or Mini for classification, extraction, or simple Q&A; upgrade only when you need deeper reasoning or larger context.
- Use the Batch API for nightly report generation, bulk embeddings, or offline evaluations – you’ll save roughly 50 % on both input and output.
- Monitor tool usage – set alerts on File Search calls and Code Interpreter sessions; delete unused files to shrink storage costs.
- Control output length – enforce
max_tokensand, for reasoning models, cap the reasoning effort if the API exposes it. - Consider migration – because the Assistants API will shut down in Aug 2026, moving to the Responses API (with optional Conversations API for managed state) now can give you lower latency, more granular cost controls, and access to newer features like structured outputs and web search without the extra per‑session fees.
Migration Outlook: What Happens After August 2026?
OpenAI announced on March 11 2025 that the Assistants API is deprecated, with a hard shutdown on August 26 2026. The replacement stack consists of:
- Responses API – a stateless, composable endpoint where you pass explicit input items and receive output items. You manage conversation history yourself, which gives you precise control over token usage and often reduces costs.
- Conversations API – adds thread‑like state management on top of Responses, preserving the “you don’t have to resend the whole history” feel while retaining the performance and pricing benefits of the stateless core.
Both new APIs support the same tools (code execution, file search, function calling, web search, deep research, etc.) but with a pay‑per‑request model that often yields lower overall spend because you avoid the automatic inclusion of full thread history on every call. If you’re building a new product today, start with the Responses/Conversations pair; if you already have an Assistants‑based app, begin the migration now to avoid a forced cut‑over later.
Frequently Asked Questions
Q: Does the Assistants API add a separate “API call” fee? A: No. You only pay the model’s token rates plus any tool‑specific charges.
Q: How does prompt caching work with assistants? A: The first few tokens of your message array (typically the system prompt and any static prefix) are checked against previous requests. If they match, those tokens are billed at the cached rate (~10 % of normal). Keep that prefix unchanged to maximize savings.
Q: Are there free tiers for the Assistants API? A: OpenAI does not offer a standing free tier for API usage. New accounts may receive trial credits, but beyond that every request is billable.
Q: Can I reduce File Search costs without deleting documents? A: Yes. You can compress or summarize documents to lower the total GB stored, and you can implement your own caching layer for frequent queries to cut the per‑call fee.
Q: Is the Code Interpreter price per execution or per hour? A: It’s billed per session, where a session is active for up to one hour of continuous use. If you keep the same session alive across multiple runs within that hour, you don’t incur additional fees.
Conclusion
The Assistants API is a powerful way to give AI agents memory, code execution, and file search without writing complex state‑management code. Its pricing, however, consists of two layers: the standard token cost of the underlying model and predictable fees for each tool you enable. Because every run typically reprocesses the entire conversation thread, unchecked thread growth can become a major cost driver.
By trimming histories, using prompt caching, picking cost‑effective models, leveraging the Batch API, and monitoring tool usage, you can keep monthly expenses in the tens or low‑hundreds of dollars for many typical workloads. And with the Assistants API slated for retirement in mid‑2026, now is the perfect time to evaluate whether migrating to the Responses/Conversations APIs will give you better performance, lower latency, and more transparent cost control—helping you build the next generation of AI agents without surprise bills.
