Important: GitHub Models was fully retired on July 30, 2026
Per GitHub's official documentation, the Playground, model catalog, inference API, and BYOK are all offline — a separate service from GitHub Copilot. This article remains a complete technical archive for migration reference; if you still have code pointing to models.github.ai, jump directly to the migration section at the end.
"Call GPT-4o with just a GitHub account? No credit card required?"
When GitHub launched GitHub Models in late 2024, many developers treated it as a "zero-cost LLM sandbox": one PAT, one OpenAI-compatible endpoint, and you could run scripts, CLIs, and GitHub Actions. It genuinely lowered the barrier for AI prototyping — but the free tier had hard rate limits, GitHub never recommended it for production, and the service lasted shorter than many expected.
This guide covers how to call the GitHub Models API, how free quotas work, pitfalls to avoid, and where to go after retirement in one place. Even though the service is gone, understanding its design still helps when choosing other inference platforms.
What Is GitHub Models
GitHub Models was GitHub's AI inference API and Playground, letting you call multi-vendor models with GitHub credentials instead of separate provider API keys. Core characteristics:
- Model catalog: OpenAI (GPT-4o, GPT-4.1, etc.), Meta Llama, DeepSeek, Microsoft Phi, and more — all referenced in a unified
publisher/model_nameformat - OpenAI compatible: Endpoints follow the
chat/completionsspec — existing OpenAI SDK / LangChain setups could switch with minimal changes - Native GitHub integration: Declare
models: readin an Actions workflow and the built-in token could call models - Tiered billing: Free tier for experiments; pay-as-you-go or BYOK (bring your own provider key) for usage beyond limits
It was a separate product line from GitHub Copilot: Copilot targets IDE coding assistance; Models targeted embedding LLMs in your own apps, scripts, or CI pipelines. After retirement, GitHub recommends Azure AI Foundry for model catalogs and Copilot for AI workflows inside GitHub.
Authentication: PAT and Scopes
Calling the inference API required GitHub credentials — two approaches:
Personal Access Token (local / server scripts)
- Open GitHub → Settings → Developer settings → Personal access tokens
- Create a Fine-grained PAT or Classic PAT, enabling
models:read(Classic shows this as themodelsscope) - Send in the request header:
Authorization: Bearer ghp_xxxx
Security tips
- Store PATs in environment variables or a secrets manager — never commit them to a repo
- For Fine-grained PATs, scope to required repos and set an expiration date
- In CI, prefer
GITHUB_TOKENover long-lived PATs to reduce leak risk
GitHub Actions Built-in Token
After declaring permissions in the workflow, the runner's GITHUB_TOKEN automatically gained models:read — no extra secret needed:
permissions:
contents: read
models: read # unlock GitHub Models inference
API Call Patterns
Core endpoint: https://models.github.ai/inference/chat/completions. Model ID format: {publisher}/{model_name}, e.g. openai/gpt-4o, meta/llama-3.3-70b-instruct.
3.1 curl Direct Call
Minimal request example (while the service was live):
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer YOUR_GITHUB_PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
https://models.github.ai/inference/chat/completions \
-d '{
"model": "openai/gpt-4o",
"messages": [
{"role": "user", "content": "用三句话解释 GitHub Models API"}
]
}'
Response structure matches OpenAI chat/completions: choices[0].message.content is the model output. Supports stream: true streaming, temperature, max_tokens, and other standard parameters.
3.2 OpenAI Python / JS SDK
Because the protocol is compatible, just change base_url and api_key:
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["GITHUB_TOKEN"],
base_url="https://models.github.ai/inference/",
)
completion = client.chat.completions.create(
model="openai/gpt-4o",
messages=[
{"role": "system", "content": "你是简洁的技术助手"},
{"role": "user", "content": "GitHub Models 和 Copilot 有什么区别?"},
],
)
print(completion.choices[0].message.content)
Frameworks that support a custom OpenAI base URL — LangChain, Vercel AI SDK, and others — had equally low migration cost. That was a key reason GitHub Models spread quickly in the open-source community.
3.3 GitHub Actions Integration
Typical use cases: automatic PR summaries, issue classification, changelog generation. Full workflow skeleton:
name: AI Triage
on:
issues:
types: [opened]
permissions:
issues: write
models: read
jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: Classify issue with LLM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -s https://models.github.ai/inference/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{
"role": "user",
"content": "将以下 Issue 分类为 bug/feature/question:..."
}]
}'
Organizations could also control which repos and members could access Models via policy — useful for standardizing AI usage across a team without sharing vendor API keys.
3.4 Model Catalog Query
List available models:
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer YOUR_GITHUB_PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://models.github.ai/catalog/models
Returns metadata per model: publisher, context window, streaming support, and more. Check the catalog first when choosing models, then cross-reference the rate limit table below — different models fall into different complexity tiers with very different limits.
Free Quotas and Rate Limits
While it lasted, the GitHub Models free API was in public preview — GitHub noted limits could change. The free tier was not unlimited; it was throttled across four dimensions:
- Requests per minute (RPM)
- Requests per day (RPD)
- Per-request token cap (input / output counted separately)
- Concurrent requests
Limits also varied with your GitHub Copilot subscription tier. The table below shows baseline values from GitHub's official documentation (Copilot Free vs Enterprise):
| Model tier | Metric | Free | Pro | Pro+ | Enterprise |
|---|---|---|---|---|---|
| Low complexity GPT-4o-mini, Llama 3, etc. |
Per minute | 15 | 15 | 15 | 20 |
| Per day | 150 | 150 | 300 | 450 | |
| Per-request tokens | 8,000 input + 4,000 output (Enterprise output 8,000) | ||||
| Concurrency | 5 | 5 | 5 | 8 | |
| High complexity GPT-4o, GPT-4.1, etc. |
Per minute | 10 | 10 | 10 | 15 |
| Per day | 50 | 50 | 100 | 150 | |
| Per-request tokens | 8,000 input + 4,000 output | 16,000 input + 8,000 output | |||
| Concurrency | 2 | 2 | 2 | 4 | |
| Embedding | Per minute | 15 | 15 | 15 | 20 |
| Per day | 150 | 150 | 300 | 450 | |
| Per-request tokens | 64,000 | ||||
| Concurrency | 5 | 5 | 5 | 8 | |
| Reasoning models DeepSeek-R1, Grok-3, etc. |
Per minute | ~1–2 | |||
| Per day | ~8–15 | ||||
| Per-request tokens | ~4,000 input + 4,000 output | ||||
| Concurrency | 1 | ||||
How to read the table
- Daily limits hit first: Free accounts got only 50 GPT-4o calls per day — batch jobs exhaust quota quickly
- Reasoning models are extremely tight: DeepSeek-R1 class models allowed only a handful of requests per day — fine for occasional testing, not regular use
- After a 429, wait for reset: Whichever limit you hit determines the wait window (minute-level or daily)
- Free tier ≠ production license: Official positioning was prototyping — no SLA, no dedicated capacity guarantee
Paid Usage and BYOK
In mid-2025, GitHub opened two paths beyond free limits:
Pay-as-you-go
- Opt in to pay-as-you-go in org / personal Billing (off by default)
- Billing unit: token unit at $0.00001 / unit
- Different models have multipliers: GPT-4o input tokens carry a 0.25 multiplier — effective cost roughly matches OpenAI direct pricing
- Unlocks higher RPM/RPD, larger context windows, and more concurrency
Bring Your Own Key (BYOK)
- Bind your own OpenAI or Azure AI key — usage counts against your provider account
- Team members never see the real API key; GitHub hosts it securely
- Same usage pattern as GitHub-hosted models in Playground, Actions, and evaluation flows
Pay-as-you-go and BYOK suited teams already in the GitHub ecosystem who wanted unified billing / permissions. If you only need raw API throughput, going direct to providers is often simpler — see the LLM pricing and selection guide.
Best Practices
1. Know your scenario: experiments yes, production no
The free tier was best for: personal side-project prototypes, open-source Action demos, comparing model outputs, and low-frequency CI helpers (e.g. PR title suggestions). Not suitable for: user-facing chat products, high-QPS backends, or latency-sensitive paths.
2. Tiered model routing
Route requests by complexity: use low-complexity models (GPT-4o-mini, smaller Llama) for simple classification / summarization; call GPT-4o or DeepSeek-R1 only when you truly need reasoning quality. Free accounts got only 50 GPT-4o calls per day — abuse it and you're done for the day.
3. Control token budget
Per-request cap was 8K input + 4K output. Summarize long documents before reasoning; keep system prompts lean; set max_tokens to prevent runaway output. Embedding allowed 64K, but bulk jobs still hit daily request limits.
4. Handle 429 gracefully
Implement exponential backoff; distinguish RPM (wait 60 seconds) from RPD (wait until next day or switch to paid); use semaphores to stay within concurrency limits (5 for low complexity, 2 for high).
5. Use GITHUB_TOKEN in Actions; short-lived PATs locally
Zero config in CI; Fine-grained PAT with expiration for local dev. Never log tokens in workflow output — use -s with curl and avoid set -x printing the Authorization header.
6. Abstract the inference layer for easy migration
Centralize base_url, model, and api_key in environment variables or a config object. With GitHub Models retired, this abstraction matters even more — the same code can point to OpenAI, Azure AI Foundry, or a self-hosted gateway.
Post-Retirement Migration (from 2026-07-30)
GitHub's official replacement paths:
| Your need | Recommended replacement | Migration notes |
|---|---|---|
| Multi-model catalog + enterprise inference | Azure AI Foundry | Closest to original GitHub Models positioning for model selection and hosted scale |
| AI workflows inside GitHub (PRs, Issues) | GitHub Copilot | IDE / PR review / Agent mode — not a raw API |
| OpenAI compatible, lowest migration cost | OpenAI API | Change base_url back to https://api.openai.com/v1 and swap API key |
| LLM calls in CI | Actions + provider secrets | Remove models: read; use OPENAI_API_KEY or similar secrets |
Minimal-change migration checklist:
- Global search for
models.github.aiand list all references - Replace
base_urland auth with your new provider - Update model IDs (e.g.
openai/gpt-4o→gpt-4o, depending on provider format) - Remove obsolete
permissions: models: readfrom workflows - Re-evaluate rate limits and billing — the free-tier illusion is gone; plan around your new platform's quotas
FAQ
Is the GitHub Models API still available?
No. Fully retired as of July 30, 2026 — all endpoints offline.
How do you authenticate?
PAT with models:read, or declare models: read in Actions and use GITHUB_TOKEN.
What was the free quota?
Low complexity: ~15 RPM / 150 RPD; high complexity: ~10 RPM / 50 RPD; reasoning models stricter. Scaled up with Copilot tier.
Was it compatible with the OpenAI API?
Yes — chat/completions. SDK: set base_url to https://models.github.ai/inference/.
Could the free tier be used in production?
No. Official positioning was experimentation — no SLA, strict rate limits.
Conclusion
How do you call the GitHub Models API? In one line: PAT auth + OpenAI-compatible endpoint + per-model-tier rate limits — it was a zero-barrier shortcut to try models, but free-tier daily requests ranged from single digits to hundreds — never a production solution.
The service is gone, but the lessons remain: use compatible protocols to lower migration cost, declare minimal permissions in CI, and abstract the inference layer into swappable config. Next step: scrub models.github.ai from your code and pick Azure AI Foundry, OpenAI direct, or Copilot by scenario — for a broader comparison, see the LLM pricing and selection guide.
LLM Agent needs to run Xcode builds? Pair with a stable Cloud Mac execution node
Model APIs moved on, but macOS build environments remain. Vuncloud dedicated Mac mini M4 lets CI / Agents run TestFlight overnight without dropping offline.
Related Reading
- LLM API Pricing, Specs & Performance Guide (2026)
- How to Choose GPT-5.6 Sol, Terra, or Luna? Performance, Price & Speed Compared (2026)
- Codex Weekly Limit Exhausted? 7 Fixes, Quota Mechanics & Alternative APIs (2026)
- The 2026 Developer AI Triad: AI Coding, Personal AI, and Agent Orchestration
Limits and retirement information are based on GitHub Models official documentation. Last updated: July 31, 2026.