[程序员] GitHub Models 免费旧模型 API,包含 openai 旧模型

两个关键参数

Base URL : https://models.github.ai/inference
API Key  : 你的 GitHub Token (当 API Key 用)

⚠️ GitHub Models 的聊天接口和模型列表接口是分开的,不走同一个地址:

  • 聊天:https://models.github.ai/inference/chat/completions
  • 模型列表:https://models.github.ai/catalog/models(不是 OpenAI 标准的 /models

获取 Token ( API Key )

  1. GitHub → 头像 → Settings
  2. 左侧底部 → Developer settings
  3. Personal access tokens → Fine-grained tokens → Generate new token
  4. Repository access 选 Public repositories
  5. Permissions 展开 Account permissions(不是 Repository permissions )→ 找到 Models → 设为 Read-only
  6. 其余不动,点 Generate token,复制保存

模型名称

调用时需加厂商前缀,例如:

  • openai/gpt-4o
  • openai/gpt-4o-mini
  • deepseek/deepseek-r1
  • meta/meta-llama-3.3-70b-instruct

完整列表:github.com/marketplace/models

常见问题

客户端提示"获取模型失败"但能正常聊天?

正常现象。GitHub Models 的模型列表接口不是 OpenAI 标准的 /models,大多数客户端调这个会 404 。手动填写模型名即可,不要依赖自动拉取。

免费额度

每个模型额度独立,超额返回 429,次日重置。