L;DR
GPT-5.4 mini costs $0.75 per 1M input tokens and $4.50 per 1M output tokens, with a 400k context window and 2x the speed of GPT-5 mini. You can call the GPT-5.4 mini API using the model ID gpt-5.4-mini via OpenAI's API and test it visually with Apidog or programmatically with Python, including writing a unit test to validate responses.
Introduction
OpenAI announced GPT-5.4 mini in March 2026 as their most capable small model yet bringing near-flagship intelligence at a fraction of the cost. If you're evaluating GPT-5.4 mini Pricing for a production workload, or looking to integrate the GPT-5.4 mini API into your app, this guide covers everything you need. We'll walk through the full pricing breakdown, API capabilities, and two hands-on integration paths: a GUI-based workflow using Apidog, and a Python code approach complete with a unit test to validate your integration.
GPT-5.4 mini Pricing Breakdown
GPT-5.4 mini Pricing is designed to make high-capability AI accessible for high-volume production use. Here's what you need to know before you start calling the GPT-5.4 mini API.
GPT-5.4 mini Input and Output Token Costs
The core GPT-5.4 mini Pricing is straightforward:
- Input tokens: $0.75 per 1M tokens
- Output tokens: $4.50 per 1M tokens
- Context window: 400,000 tokens
For regional processing (data residency endpoints), OpenAI applies a 10% pricing uplift on top of standard GPT-5.4 mini Pricing. This means input tokens cost $0.825/1M and output tokens cost $4.95/1M when using regional endpoints.
GPT-5.4 mini vs GPT-5.4 nano Pricing Comparison
To put GPT-5.4 mini Pricing in context, here's how it compares to the rest of the GPT-5.4 family:
| Model | Input (per 1M tokens) | Output (per 1M tokens) | Context Window |
|---|---|---|---|
| GPT-5.4 | ~$5.00 | ~$20.00 | 400k |
| GPT-5.4 mini | $0.75 | $4.50 | 400k |
| GPT-5.4 nano | $0.20 | $1.25 | 400k |
GPT-5.4 nano is the cheapest option, but GPT-5.4 mini hits the sweet spot between cost and capability especially for coding, reasoning, and multimodal tasks where nano falls short.
GPT-5.4 mini Pricing in Codex
When using the GPT-5.4 mini API inside OpenAI's Codex environment, the model consumes only 30% of the GPT-5.4 quota. This makes it ideal for multi-agent Codex setups where a larger model like GPT-5.4 handles planning and coordination, while GPT-5.4 mini subagents handle parallel subtasks at roughly one-third the cost.
GPT-5.4 mini API Capabilities
The GPT-5.4 mini API is not just a cheaper model it's a genuinely capable one. Here's what it supports:
- Text and image inputs — multimodal by default
- Tool use and function calling — structured outputs for agentic workflows
- Web search — built-in grounding against live web data
- File search — query over uploaded documents
- Computer use — interact with desktop environments programmatically
- Skills — composable task modules
The GPT-5.4 mini API runs more than 2x faster than GPT-5 mini, and approaches GPT-5.4 performance on key benchmarks including SWE-Bench Pro (software engineering) and OSWorld-Verified (computer use). It's available via the OpenAI API, Codex, and ChatGPT.
The model ID to use in your GPT-5.4 mini API calls is:
gpt-5.4-mini
How to Use GPT-5.4 mini API with Apidog
Apidog is an all-in-one API development platform that lets you design, debug, test, and document APIs without writing a single line of code. It's the fastest way to make your first GPT-5.4 mini API call and run a unit test against the response all from a clean GUI.
Download Apidog for free and follow the steps below.
Setting Up the GPT-5.4 mini API Request in Apidog
- Open Apidog and create a new project (e.g.,
GPT-5.4 mini API Test).
2. Create a new HTTP request:
- Method:
POST - URL:
https://api.openai.com/v1/chat/completions
3. Â Add headers under the Headers tab:
| Key | Value |
|---|---|
Authorization | Bearer YOUR_OPENAI_API_KEY |
Content-Type | application/json |
4.  Set the request body (Body → JSON):
{
"model": "gpt-5.4-mini",
"messages": [
{
"role": "user",
"content": "Explain what a unit test is in one sentence."
}
],
"temperature": 0.7,
"max_tokens": 200
}5. Â Click Send. Apidog displays the full response, including token usage which maps directly to GPT-5.4 mini Pricing so you can estimate costs in real time.
A successful response looks like:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "gpt-5.4-mini",
"choices": [
{
"message": {
"role": "assistant",
"content": "A unit test is an automated check that verifies a single function or component behaves as expected in isolation."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 28,
"total_tokens": 46
}
}Writing Unit Tests for GPT-5.4 mini API in Apidog
Apidog has a built-in test scripting engine. After sending your request, go to the Tests tab and add assertions to create a unit test for the GPT-5.4 mini API response:
// Unit test 1: Verify HTTP status is 200
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
// Unit test 2: Confirm the correct model was used
pm.test("GPT-5.4 mini API model is correct", function () {
const json = pm.response.json();
pm.expect(json.model).to.include("gpt-5.4-mini");
});
// Unit test 3: Response contains a message
pm.test("Response has assistant message", function () {
const json = pm.response.json();
pm.expect(json.choices[0].message.content).to.be.a("string").and.not.empty;
});
// Unit test 4: Token usage is reported (for GPT-5.4 mini Pricing tracking)
pm.test("Token usage is present", function () {
const json = pm.response.json();
pm.expect(json.usage.total_tokens).to.be.above(0);
});
These four unit test assertions cover the most critical aspects of a GPT-5.4 mini API integration: status, model identity, response content, and token usage. Apidog runs all of them automatically every time you hit Send, making it easy to catch regressions as you iterate.
You can also save this request as part of an Apidog test suite and run it in CI/CD pipelines using Apidog's CLI runner.
How to Use GPT-5.4 mini API with Python
For production integrations, here's a complete Python example calling the GPT-5.4 mini API with a unit test using pytest.
Installation
pip install openai pytest
Basic GPT-5.4 mini API Call
# gpt54mini_client.py
from openai import OpenAI
client = OpenAI() # reads OPENAI_API_KEY from environment
def ask_gpt54_mini(prompt: str) -> dict:
"""Call the GPT-5.4 mini API and return the full response."""
response = client.chat.completions.create(
model="gpt-5.4-mini", # GPT-5.4 mini API model ID
messages=[
{"role": "user", "content": prompt}
],
temperature=0.7,
max_tokens=500
)
return {
"content": response.choices[0].message.content,
"model": response.model,
"total_tokens": response.usage.total_tokens,
"prompt_tokens": response.usage.prompt_tokens,
"completion_tokens": response.usage.completion_tokens,
}
if __name__ == "__main__":
result = ask_gpt54_mini("What is a unit test?")
print(result["content"])
# Estimate cost based on GPT-5.4 mini Pricing
input_cost = (result["prompt_tokens"] / 1_000_000) * 0.75
output_cost = (result["completion_tokens"] / 1_000_000) * 4.50
print(f"Estimated cost: ${input_cost + output_cost:.6f}")
Unit Test for GPT-5.4 mini API
# test_gpt54mini_client.py
import pytest
from unittest.mock import patch, MagicMock
from gpt54mini_client import ask_gpt54_mini
@pytest.fixture
def mock_openai_response():
"""Mock the GPT-5.4 mini API response for unit testing."""
mock_response = MagicMock()
mock_response.choices[0].message.content = (
"A unit test verifies a single function in isolation."
)
mock_response.model = "gpt-5.4-mini"
mock_response.usage.total_tokens = 46
mock_response.usage.prompt_tokens = 18
mock_response.usage.completion_tokens = 28
return mock_response
@patch("gpt54mini_client.client.chat.completions.create")
def test_returns_content(mock_create, mock_openai_response):
"""Unit test: GPT-5.4 mini API returns non-empty content."""
mock_create.return_value = mock_openai_response
result = ask_gpt54_mini("What is a unit test?")
assert isinstance(result["content"], str)
assert len(result["content"]) > 0
@patch("gpt54mini_client.client.chat.completions.create")
def test_correct_model(mock_create, mock_openai_response):
"""Unit test: confirms gpt-5.4-mini model ID is used."""
mock_create.return_value = mock_openai_response
result = ask_gpt54_mini("Hello")
assert result["model"] == "gpt-5.4-mini"
@patch("gpt54mini_client.client.chat.completions.create")
def test_token_usage_reported(mock_create, mock_openai_response):
"""Unit test: token usage is present for GPT-5.4 mini Pricing tracking."""
mock_create.return_value = mock_openai_response
result = ask_gpt54_mini("Hello")
assert result["total_tokens"] > 0
assert result["prompt_tokens"] + result["completion_tokens"] == result["total_tokens"]
Run the unit tests:
pytest test_gpt54mini_client.py -v
Expected output:
test_gpt54mini_client.py::test_returns_content PASSED
test_gpt54mini_client.py::test_correct_model PASSED
test_gpt54mini_client.py::test_token_usage_reported PASSED
3 passed in 0.31s
Mocking the GPT-5.4 mini API in your unit test suite means you don't burn tokens during CI runs critical for keeping GPT-5.4 mini Pricing costs under control in automated pipelines.
GPT-5.4 mini API Best Practices
Getting the most out of the GPT-5.4 mini API means being deliberate about how you use it. Here are the key practices:
1. Always track token usage for GPT-5.4 mini Pricing control Log prompt_tokens and completion_tokens per request. At $0.75/1M input and $4.50/1M output, costs scale fast with verbose prompts. Keep system prompts tight.
2. Use Apidog for exploratory testing before writing code Before building a full integration, use Apidog to prototype your prompts and validate the GPT-5.4 mini API response shape. This saves time and avoids wasted tokens during development.
3. Write unit tests early Add a unit test for every function that calls the GPT-5.4 mini API. Mock the API response so your test suite runs fast and free. Use Apidog's test scripts for GUI-based unit test coverage, and pytest with unittest.mock for code-level coverage.
4. Use the 400k context window strategically The GPT-5.4 mini API supports 400k tokens of context but you pay for every token. For RAG pipelines, retrieve only the most relevant chunks rather than stuffing the full context window.
5. Avoid regional endpoints unless required Regional processing adds a 10% uplift to GPT-5.4 mini Pricing. Only use data residency endpoints if your compliance requirements demand it.
6. Delegate to GPT-5.4 mini in multi-agent systems In Codex or agentic pipelines, use GPT-5.4 for planning and GPT-5.4 mini for parallel subtasks. At 30% of the GPT-5.4 quota, the GPT-5.4 mini API is the right tool for high-frequency, narrowly scoped tasks.
Conclusion
GPT-5.4 mini Pricing at $0.75/1M input and $4.50/1M output makes it one of the most cost-effective ways to access near-flagship AI capabilities. The GPT-5.4 mini API supports multimodal inputs, function calling, web search, and more all at 2x the speed of its predecessor.
Whether you're prototyping with Apidog's GUI, writing production Python code, or setting up a unit test suite to validate your integration, the GPT-5.4 mini API fits cleanly into modern development workflows. Start with Apidog to explore the API visually, then move to code with confidence.
Try Apidog free no credit card required.
FAQ
What is GPT-5.4 mini Pricing? GPT-5.4 mini costs $0.75 per 1M input tokens and $4.50 per 1M output tokens. Regional processing endpoints add a 10% uplift to standard GPT-5.4 mini Pricing.
What is the GPT-5.4 mini API model ID? Use gpt-5.4-mini as the model parameter in your GPT-5.4 mini API calls.
How do I test the GPT-5.4 mini API without writing code? Use Apidog. Create a POST request to https://api.openai.com/v1/chat/completions with your API key and the gpt-5.4-mini model ID. Apidog also lets you write unit test assertions directly in the UI.
How do I write a unit test for the GPT-5.4 mini API? Mock the API client using unittest.mock in Python and assert on the response structure. In Apidog, use the Tests tab to add JavaScript-based unit test assertions after each request.
How does GPT-5.4 mini Pricing compare to GPT-5.4 nano? GPT-5.4 nano is cheaper at $0.20/1M input and $1.25/1M output, but GPT-5.4 mini offers significantly better performance on coding and reasoning benchmarks like SWE-Bench Pro.
Can I use the GPT-5.4 mini API in Codex? Yes. The GPT-5.4 mini API is available in Codex and consumes only 30% of the GPT-5.4 quota, making it ideal for parallel subagent tasks.
Is GPT-5.4 mini available in ChatGPT? Yes. GPT-5.4 mini is available via the OpenAI API, Codex, and ChatGPT.
