APIMart
Back to all models

GPT-4o mini API

OpenAIModel ID gpt-4o-miniText modelReleased July 18, 2024

Use GPT-4o mini to sort a batch of support tickets into categories, pull the tracking number and dates out of a shipping notice, or answer a customer in one sentence based on your return policy.

Max input
128,000 tokens
Max output
16,384 tokens
Input → output
Text, Image → Text
Knowledge cutoff
October 1, 2023
  • Image input
  • Streaming
  • Cached input pricing
  • OpenAI SDK compatible

GPT-4o mini API use cases

Each use case comes with an illustrative example: source material, a prompt and a hand-written sample answer, not actual model output. Copy the prompt, swap in your own material and try it on GPT-4o mini.

Try GPT-4o mini with your own material

Classify tickets in bulk

Give GPT-4o mini a fixed set of categories and have it label each ticket, returning JSON. Spot-check a few dozen per batch, and add examples for categories it confuses.

Example: Which category does each ticket belong to?

Material

Tickets
#101 I was charged twice last month · #102 I don’t get the verification code and can’t log in · #103 Please let me export reports as PDF

PromptPut each ticket into one of “billing, login, feature request, other”, and return a JSON array of id and category.

Sample answer · written by hand to show the reasoning

[{"id": 101, "category": "billing"}, {"id": 102, "category": "login"}, {"id": 103, "category": "feature request"}]. #101 is a duplicate charge, so billing; #102 can’t log in because the code doesn’t arrive; #103 asks for a new export format.

About the GPT-4o mini API

  • Fast and cheap for high volume

    OpenAI positions it as a “fast, affordable small model for focused tasks”, more than 60% cheaper than GPT-3.5 Turbo at launch. Reported scores: 82.0% on MMLU, 87.0% on MGSM, 87.2% on HumanEval and 59.4% on MMMU, all ahead of Gemini Flash and Claude Haiku at the time.

  • Instruction hierarchy against prompt injection

    GPT-4o mini is the first model to apply OpenAI’s instruction hierarchy method, which helps it resist jailbreaks, prompt injections and system prompt extraction.

  • Function calling and structured outputs

    Supports function calling, structured outputs that follow a JSON Schema, and streaming; OpenAI notes that outputs from a larger model like GPT-4o can be distilled into GPT-4o mini.

  • GPT-4o mini API key and access

    You don’t need a separate GPT-4o mini API key: one APIMart key works for every model. Check the GPT-4o mini pricing table on this page for current GPT-4o mini API pricing, then call an OpenAI Chat Completions-compatible endpoint with the model ID gpt-4o-mini.

How to call the GPT-4o mini API

To call GPT-4o mini, you only need an APIMart API key and your existing OpenAI SDK, or send plain HTTP requests.

POST /v1/chat/completions
curl https://api.apimart.ai/v1/chat/completions \
  -H "Authorization: Bearer $APIMART_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-4o-mini",
  "messages": [
    {
      "role": "user",
      "content": "Describe how to design a clear API in three sentences."
    }
  ],
  "stream": false
}'

GPT-4o mini access details

Model IDgpt-4o-mini
Base URLhttps://api.apimart.ai/v1
Endpoint/chat/completions

Common parameters

model
Required
messages
Required
stream
Optional
max_tokens
Optional
temperature
Optional
All request parameters, response fields and error codes

GPT-4o mini API request parameters

GPT-4o mini uses the general chat endpoint, POST /v1/chat/completions, with a JSON body. model and messages are required; every other parameter is optional.

ParameterTypeRequiredDescription
modelstringYesModel ID. Use gpt-4o-mini for this model.
messagesarrayYesConversation messages. Each message has a role (system, user, or assistant) and content. Include earlier messages for multi-turn conversations.
streambooleanNoWhether to stream the output. true returns chunks over SSE, false returns the full response at once. Default: true.
temperaturenumberNoOutput randomness, 0–2. Default: 1.0. Lower values give more deterministic output.
top_pnumberNoNucleus sampling, 0–1. Default: 1.0. Adjust this or temperature, not both.
max_tokensintegerNoMaximum number of tokens to generate for the reply.
frequency_penaltynumberNoFrequency penalty, -2.0 to 2.0. Default: 0. Positive values reduce repeated wording.
presence_penaltynumberNoPresence penalty, -2.0 to 2.0. Default: 0. Positive values encourage new topics.
stopstring | arrayNoUp to 4 stop sequences. Generation stops when any of them appears.
nintegerNoNumber of replies to generate. Default: 1.

Response fields

The response contains the fields below. Token usage is returned in usage, which you can use to check costs.

FieldTypeDescription
idstringUnique identifier for the request.
modelstringThe model that handled the request.
choicesarrayList of replies. Each item contains message (role and content) and finish_reason.
usageobjectToken usage: prompt_tokens, completion_tokens, and total_tokens.

Error codes

Failed requests return an error object with code, message, and type.

StatusTypeMeaning
400invalid_request_errorInvalid request parameters.
401authentication_errorThe API key is invalid or missing.
402payment_requiredInsufficient account balance.
403permission_errorNo permission to access this resource.
429rate_limit_errorToo many requests. Retry later.
500server_errorInternal server error.
502bad_gatewayGateway error. The service is temporarily unavailable.

GPT-4o mini API pricing

The GPT-4o mini API is billed by token usage, and prices depend on your membership tier. Prices below are per million tokens; 1 US dollar = 10 credits.

ItemGoldCurrent pricePlatinumDiamondOfficial priceYou save
Input1.2Credits~$0.121.14Credits~$0.1141.08Credits~$0.1081.5Credits~$0.1520%
Cached input0.6Credits~$0.060.57Credits~$0.0570.54Credits~$0.0540.75Credits~$0.07520%
Output4.8Credits~$0.484.56Credits~$0.4564.32Credits~$0.4326Credits~$0.620%

Prices are for reference only. View full pricing

Why call GPT-4o mini API through APIMart

  • 20% below official pricing

    GPT-4o mini API pricing is billed by token usage. Gold to Diamond member prices are 20%–28% below OpenAI's official prices, and cached input costs just $0.06 per 1M tokens.

    See membership prices
  • One API key for 500+ models

    GPT-4o mini, the rest of its family and 500+ models from GPT, Claude, Gemini and more share one API key and one account balance. Switching models is just a change to the model parameter.

  • Change two lines of existing code

    If you already use the OpenAI SDK, point base_url at https://api.apimart.ai/v1 and swap in your APIMart API key. Requests and responses keep the same format.

  • Try it online before you code

    Try GPT-4o mini with your own material in the Playground, no code or setup needed, and integrate once you like the results.

    Open Playground

Which OpenAI model should you choose?

Base prices per 1M tokens (USD). Your GPT-4o mini API key works for every model in the table; just change the model parameter.

Differences between OpenAI models
ComparisonGPT-4o mini CurrentGPT-4oGPT-4o-2024-11-20GPT-4.1GPT-4.1 minio3GPT-5GPT-5 miniGPT-5 nanoGPT-5 ProGPT-5 SearchGPT-5.1GPT-5.2GPT-5.2 ProGPT-5.3-CodexGPT-5.4GPT-5.4 miniGPT-5.4 nanoGPT-5.4 ProGPT-5.5GPT-5.6 LunaGPT-5.6 SolGPT-5.6 TerraGPT-6 AstraGPT-6 LunaGPT-6 SolGPT-6.1 SolGPT-6.1 TerraGPT-6.2 AstraGPT-6.2 Sol
Best forHigh-volume classification and extraction, Text and image input, Low-cost small modelText and image input, Function calling and structured outputs, No reasoning step, fast repliesNewest GPT-4o snapshot, Text and image input, No reasoning step, fast repliesInstruction following, Deprecated, 1M-token contextFast and low-cost, Deprecated, 1M-token contextDeep reasoning, Visual reasoning, Coding and technical writingCoding and agents, Deprecated, Reasoning effort minimal to highCost-efficient reasoning, Deprecated, 400K contextFastest and cheapest, Deprecated, ClassificationHard reasoning, Deprecated, Responses APIWeb search in Chat Completions, Searches before every answer, Text in, text outCoding and agents, Deprecated, Text and image inputProfessional work, Reasoning up to xhigh, Text and image inputHard reasoning, More compute per request, Responses APIAgentic coding, 400K context, Responses APICoding and professional work, 1.05M context, Text and image inputCoding and subagents, 400K context, Text and image inputClassification and extraction, Cheapest GPT-5.4 model, Text and image inputHard reasoning, More compute per request, Text and image inputCoding and professional work, 1.05M context, Reasoning from none to xhighHigh-volume tasks, Classification, Data extractionComplex professional work, Coding and debugging, Text and image inputBalanced cost, Support and review, Text and image inputComplex coding, Professional work, ResearchStructured summaries, Classification, Data extractionComplex coding, Agentic workflows, Testing and debuggingComplex coding, Professional documents, Business workflowsVisual reasoning, Drawings and screenshots, WritingComplex coding, Long-document analysis, Professional researchEveryday coding, Agentic tasks, Writing
Input typesText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageTextText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, ImageText, Image
Max input128,000 tokens128,000 tokens128,000 tokens1,047,576 tokens1,047,576 tokens200,000 tokens272,000 tokens272,000 tokens272,000 tokens272,000 tokens272,000 tokens272,000 tokens272,000 tokens272,000 tokens272,000 tokens922,000 tokens272,000 tokens272,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens922,000 tokens
Max output16,384 tokens16,384 tokens16,384 tokens32,768 tokens32,768 tokens100,000 tokens128,000 tokens128,000 tokens128,000 tokens272,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens
Knowledge cutoffOctober 1, 2023October 1, 2023October 1, 2023June 1, 2024June 1, 2024June 1, 2024September 30, 2024May 31, 2024May 31, 2024September 30, 2024—September 30, 2024August 31, 2025August 31, 2025August 31, 2025August 31, 2025August 31, 2025August 31, 2025August 31, 2025December 1, 2025February 16, 2026February 16, 2026February 16, 2026April 30, 2026May 18, 2026April 20, 2026April 30, 2026June 1, 2026May 18, 2026June 1, 2026
Input price$0.12$2$2$1.6$0.32$1.6$1$0.2$0.04$12$1$1$1.4$16.8$1.4$2$0.6$0.16$24$4$0.16$3.2$1.6$8$0.08$1.6$1.6$0.8$6.4$1.6
Output price$0.48$8$8$6.4$1.28$6.4$8$1.6$0.32$96$8$8$11.2$134.4$11.2$12$3.6$1$144$24$0.96$16$9.6$40$0.4$8$8$4$32$8

GPT-4o mini FAQ

What is GPT-4o mini’s knowledge cutoff?

OpenAI’s model page lists a knowledge cutoff of October 2023 for GPT-4o mini. For anything newer, put the relevant information in the prompt.

What changes when I move from GPT-4o mini to GPT-6 Luna?

Change the model parameter from gpt-4o-mini to gpt-6-luna; the endpoint and API key stay the same. For high-volume jobs, compare accuracy, latency and price on a labeled sample before switching everything over.

How is GPT-4o mini different from GPT-4o?

Both have the same context window, maximum output and input types, and both support image input, function calling and structured outputs. GPT-4o is more capable; GPT-4o mini is faster and cheaper, which OpenAI positions for focused, lightweight tasks. OpenAI also notes that outputs from a larger model like GPT-4o can be distilled into GPT-4o mini to get similar results at lower cost and latency.

Does GPT-4o mini protect against prompt injection?

OpenAI says GPT-4o mini is the first model to apply its instruction hierarchy method, which helps it resist jailbreaks, prompt injections and system prompt extraction, and it has the same built-in safety mitigations as GPT-4o. Even so, pass untrusted external text separately from your instructions and limit which tools the model can call.

Which version does gpt-4o-mini point to?

gpt-4o-mini has a single snapshot, gpt-4o-mini-2024-07-18, which is also its default.

Is GPT-4o mini cost-effective for non-English text?

OpenAI says GPT-4o mini shares GPT-4o’s improved tokenizer, which uses fewer tokens for non-English text, so it costs less too. With per-token billing, the same non-English content is cheaper than on models with the older tokenizer; check the usage field in the API response for exact counts.

How can I try this model online?

Click Start chatting or Open Playground to visit the existing APIMart Playground. Select GPT-4o mini in the text category to start exploring.

Which model ID does the GPT-4o mini API use?

Set model to gpt-4o-mini. Copy the exact ID from the page heading or the integration details panel.

Is it compatible with the OpenAI SDK?

You can keep the OpenAI SDK. Set base_url to https://api.apimart.ai/v1, provide your APIMart API key, and use the model ID on this page.

What is the context window of GPT-4o mini?

On APIMart, GPT-4o mini accepts up to 128,000 input tokens per request. Your prompt, earlier messages, and file content all count toward it.

How many tokens can it output at once?

GPT-4o mini can output up to 16,384 tokens in a single reply. Use the max_tokens parameter to set a lower limit.

How much does the GPT-4o mini API cost?

The GPT-4o mini API on APIMart is billed by token, and prices depend on your membership tier. Gold: $0.12 per million input tokens and $0.48 per million output tokens. Diamond: $0.108 per million input tokens and $0.432 per million output tokens. Prices may change; the pricing page has the current rates.

Does it support streaming?

Yes. The general chat endpoint streams over SSE by default. Set stream to false to receive the complete response at once.

How do I get an API key?

Sign in to APIMart and create a key on the API Keys page, then send it in the Authorization: Bearer header. The same key also works for other models on the platform.