o4-mini — Free API

Created by OpenAI ⭐ Score: 60
github-models/o4-mini
🛠️ Function Calling JSON Mode chat

What is o4-mini?

o4-mini is OpenAI's latest-generation small reasoning model, available free through GitHub Models. Building on the o3 architecture with improved reasoning efficiency, it uses internal chain-of-thought deliberation to tackle math, coding challenges, and logic problems that trip up standard chat models. With 200K context, 100K max output, and full OpenAI SDK compatibility, it works as a drop-in replacement in any tool that supports custom base URLs. Free tier limits are 10 RPM and 50 requests per day, with per-request caps applying. Requires only a GitHub account — no separate API key or credit card needed.

Model ID
o4-mini
Base URL
https://models.github.ai/inference

o4-mini API Code Example

Paste your API key and run. See the config generator for Claude Code, Cursor, and more tools.

from openai import OpenAI

client = OpenAI(
    base_url="https://models.github.ai/inference",
    api_key="YOUR_API_KEY"
)

response = client.chat.completions.create(
    model="o4-mini",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
import OpenAI from "openai";

const openai = new OpenAI({
  baseURL: "https://models.github.ai/inference",
  apiKey: "YOUR_API_KEY",
});

const completion = await openai.chat.completions.create({
  model: "o4-mini",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(completion.choices[0].message.content);
curl https://models.github.ai/inference/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "o4-mini",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Other Free Models from GitHub Models

More About GitHub Models

How to get an API key, rate limits, platform limitations, and tool configuration — everything you need to set up GitHub Models as a free LLM API backend.

View GitHub Models full guide →