API for the model openai/gpt-4.1-mini at GitHub Models, pricing at the provider. curl, Python and JavaScript samples, live testing.
Free with limits, GitHub token.
- Type
- Model
- Provider
- GitHub Models
- Model ID
openai/gpt-4.1-mini- Pricing
- Free + paid
- Keyless access
- No
- Key variable
GITHUB_TOKEN- Base URL (OpenAI-compatible)
https://models.github.ai/inference- Inputs
- Text
- Developer rating
- Not rated yet
- Documentation
- https://github.com/marketplace/models
Code samples
cURL
curl https://models.github.ai/inference/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d '{"model":"openai/gpt-4.1-mini","messages":[{"role":"user","content":"Hello, introduce yourself in one sentence."}]}'Python
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
r = client.chat.completions.create(
model="openai/gpt-4.1-mini",
messages=[{"role": "user", "content": "Hello, introduce yourself in one sentence."}],
)
print(r.choices[0].message.content)JavaScript
// npm install openai
import OpenAI from 'openai'
const client = new OpenAI({ baseURL: 'https://models.github.ai/inference', apiKey: process.env.GITHUB_TOKEN })
const r = await client.chat.completions.create({
model: 'openai/gpt-4.1-mini',
messages: [{ role: 'user', content: 'Hello, introduce yourself in one sentence.' }],
})
console.log(r.choices[0].message.content)
Generate the integration code →
Popular searches
Frequently asked questions
Is the GitHub Models · openai/gpt-4.1-mini API free?
GitHub Models · openai/gpt-4.1-mini offers a limited free tier; beyond it, usage is paid.
How do I call GitHub Models · openai/gpt-4.1-mini from my code?
GitHub Models · openai/gpt-4.1-mini exposes an OpenAI-compatible API at https://models.github.ai/inference: use any OpenAI SDK (Python, JavaScript…) with this base URL. Model identifier: openai/gpt-4.1-mini. Ready-to-use code (streaming, JSON, retries) is available in the developer toolkit.
What are the alternatives to GitHub Models · openai/gpt-4.1-mini?
Similar APIs listed in the catalog: gpt-oss-20b · AkashML, gpt-oss-20b · Amazon Bedrock, gpt-oss-20b · CoreWeave, gpt-oss-20b · Groq, gpt-oss-20b · Parasail.
Alternatives
- gpt-oss-20b · AkashML — Paid
- gpt-oss-20b · Amazon Bedrock — Paid
- gpt-oss-20b · CoreWeave — Paid
- gpt-oss-20b · Groq — Paid
- gpt-oss-20b · Parasail — Paid
- gpt-oss-120b · AkashML — Paid
- gpt-oss-120b · Amazon Bedrock — Paid
- gpt-oss-120b · BaseTen — Paid
- gpt-oss-120b · Cerebras — Paid
- gpt-oss-120b · CoreWeave — Paid
- gpt-oss-120b · Crusoe — Paid
- gpt-oss-120b · DeepInfra — Paid