APIMart
Back to all models

GPT-4.1 mini API

OpenAIModel ID gpt-4.1-miniText modelReleased April 14, 2025

GPT-4.1 mini will be retired on January 14, 2027, after which API calls will stop working. We recommend migrating to GPT-6 Luna ahead of time.

View GPT-6 Luna

Use GPT-4.1 mini to sort support tickets into categories, pull fields out of invoices into JSON, or read the numbers off a chart, quickly and at low cost.

Max input
1,047,576 tokens
Max output
32,768 tokens
Input → output
Text, Image → Text
Knowledge cutoff
June 1, 2024
  • Image input
  • Streaming
  • Cached input pricing
  • OpenAI SDK compatible

GPT-4.1 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-4.1 mini.

Try GPT-4.1 mini with your own material

Classifying tickets and messages

Send each support ticket with your category list and ask GPT-4.1 mini for one category and a short reason. Review a sample of results each week and adjust the category definitions.

Example: Which category is this ticket?

Material

Support ticket
I was charged twice for my March subscription. Please refund the extra payment.

PromptClassify the ticket into one of: billing, login, bug, feature request. Reply with the category and one sentence of reasoning.

Sample answer · written by hand to show the reasoning

billing — the customer reports a duplicate charge for the March subscription and asks for a refund.

About the GPT-4.1 mini API

  • Smaller, faster GPT-4.1

    GPT-4.1 mini excels at instruction following and tool calling with low latency, and OpenAI reported that it often beats GPT-4o on image benchmarks.

  • Shutdown on January 14, 2027

    OpenAI deprecated GPT-4.1 mini on October 14, 2026 and recommends GPT-6 Luna as the replacement.

  • 1M context, 32K output

    The context window is 1,047,576 tokens and the maximum output 32,768 tokens, with text and image input. Function calling, structured outputs and streaming are supported.

  • GPT-4.1 mini API key and access

    You don’t need a separate GPT-4.1 mini API key: one APIMart key works for every model, including GPT-6 Luna. Send gpt-4.1-mini API requests with the model ID gpt-4.1-mini; GPT-4.1 mini API pricing is in the table on this page.

GPT-4.1 mini official benchmark results

Selected results OpenAI published at launch.

  • MMMU

    72.7%

    Questions about charts, diagrams and maps. Ahead of GPT-4o (68.7%) and GPT-4o mini (56.3%).

  • MathVista

    73.1%

    Visual math problems. Ahead of GPT-4o (61.4%) and GPT-4o mini (56.5%).

  • IFEval

    84.1%

    Following verifiable instructions such as length and format. Ahead of GPT-4o mini (78.4%).

  • MultiChallenge

    35.8%

    Following instructions across multi-turn conversations. Ahead of GPT-4o (27.8%) and GPT-4o mini (20.3%).

  • GPQA Diamond

    65.0%

    Graduate-level science questions. Ahead of GPT-4o (46.0%) and GPT-4o mini (40.2%).

  • SWE-bench Verified

    23.6%

    Fixing real issues in code repositories. Ahead of GPT-4o mini (8.7%); GPT-4.1 scores 54.6%.

How to call the GPT-4.1 mini API

To call GPT-4.1 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-4.1-mini",
  "messages": [
    {
      "role": "user",
      "content": "Describe how to design a clear API in three sentences."
    }
  ],
  "stream": false
}'

GPT-4.1 mini access details

Model IDgpt-4.1-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-4.1 mini API request parameters

GPT-4.1 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-4.1-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-4.1 mini API pricing

The GPT-4.1 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
Input3.2Credits~$0.323.04Credits~$0.3042.88Credits~$0.2884Credits~$0.420%
Cached input0.8Credits~$0.080.76Credits~$0.0760.72Credits~$0.0721Credits~$0.120%
Output12.8Credits~$1.2812.16Credits~$1.21611.52Credits~$1.15216Credits~$1.620%

Prices are for reference only. View full pricing

Why call GPT-4.1 mini API through APIMart

  • 20% below official pricing

    GPT-4.1 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.08 per 1M tokens.

    See membership prices
  • One API key for 500+ models

    GPT-4.1 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-4.1 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-4.1 mini API key works for every model in the table; just change the model parameter.

Differences between OpenAI models
ComparisonGPT-4.1 mini CurrentGPT-4oGPT-4o miniGPT-4o-2024-11-20GPT-4.1o3GPT-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 forFast and low-cost, Deprecated, 1M-token contextText and image input, Function calling and structured outputs, No reasoning step, fast repliesHigh-volume classification and extraction, Text and image input, Low-cost small modelNewest GPT-4o snapshot, Text and image input, No reasoning step, fast repliesInstruction following, 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 input1,047,576 tokens128,000 tokens128,000 tokens128,000 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 output32,768 tokens16,384 tokens16,384 tokens16,384 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 cutoffJune 1, 2024October 1, 2023October 1, 2023October 1, 2023June 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.32$2$0.12$2$1.6$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$1.28$8$0.48$8$6.4$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-4.1 mini FAQ

Is GPT-4.1 mini being retired?

Yes. OpenAI deprecated GPT-4.1 mini (snapshot gpt-4.1-mini-2025-04-14) on October 14, 2026, with a shutdown date of January 14, 2027. The recommended replacement is GPT-6 Luna.

How do I migrate from GPT-4.1 mini to GPT-6 Luna?

Change the model parameter in your gpt-4.1-mini API requests to gpt-6-luna; the APIMart API key and endpoint stay the same. Re-run a sample of your real requests, especially classification and extraction prompts, and compare quality, latency and cost before switching all traffic.

Does GPT-4.1 mini support prompt caching?

Yes. When requests repeat the same prompt prefix, such as a long system prompt with your category list, the cached part is billed at a 75% discount on the input price, according to OpenAI’s launch post. Put the fixed content first and the changing input last.

What is the difference between GPT-4.1 mini and GPT-4.1?

GPT-4.1 mini is smaller, faster and cheaper, with the same 1,047,576-token context window and 32,768-token output limit. On image benchmarks it is close to GPT-4.1 (MMMU 72.7% vs. 74.8%), but GPT-4.1 is much stronger at coding (SWE-bench Verified 54.6% vs. 23.6%).

How can I try this model online?

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

Which model ID does the GPT-4.1 mini API use?

Set model to gpt-4.1-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-4.1 mini?

On APIMart, GPT-4.1 mini accepts up to 1,047,576 input tokens per request. Your prompt, earlier messages, and file content all count toward it.

How many tokens can it output at once?

GPT-4.1 mini can output up to 32,768 tokens in a single reply. Use the max_tokens parameter to set a lower limit.

How much does the GPT-4.1 mini API cost?

The GPT-4.1 mini API on APIMart is billed by token, and prices depend on your membership tier. Gold: $0.32 per million input tokens and $1.28 per million output tokens. Diamond: $0.288 per million input tokens and $1.152 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.