GPT-4.1 Mini API

GPT-4.1 mini is a cost-effective variant of GPT-4.1 with 1M token context, optimized for speed and efficiency.
Context
1M tokens
Input
$0.52 / 1M
Output
$2.08 / 1M
Released
Aug 7, 2025

How to use GPT-4.1 Mini API

Install any OpenAI-compatible SDK, point it at api.aimlapi.com/v1, and set the model to openai/gpt-4.1-mini-2025-04-14.
import requests

r = requests.post(
    "https://api.aimlapi.com/v1/chat/completions",
    headers={"Authorization": "Bearer " + AIMLAPI_KEY},
    json={
      "model": "openai/gpt-4.1-mini-2025-04-14",
      "messages": [
        {
          "role": "user",
          "content": "Hello!"
        }
      ]
    },
)
print(r.json())
const r = await fetch("https://api.aimlapi.com/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "openai/gpt-4.1-mini-2025-04-14",
    "messages": [
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }),
});
console.log(await r.json());
curl -X POST https://api.aimlapi.com/v1/chat/completions \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4.1-mini-2025-04-14","messages":[{"role":"user","content":"Hello!"}]}'

OpenAI-compatible — swap the base URL and it works with your existing SDK.

GPT-4.1 Mini API Pricing

TypePrice
Input
$0.52 / 1M tokens
Output
$2.08 / 1M tokens

GPT-4.1 Mini Benchmarks

BenchmarkScoreWhat it measures
GPQA Diamond
65%
Google-proof graduate science questions (hardest subset)
SWE-bench Verified
23.6%
Resolving verified real GitHub issues

Start building with GPT-4.1 Mini

Get API Key
1000+ models, one API.