TensaHub › GitHub Models

GitHub Models · openai/gpt-4.1-mini

GitHub Models 提供的 openai/gpt-4.1-mini 模型 API,价格见服务商。提供 curl、Python、JavaScript 示例及在线测试。

在目录中测试并评分

Free with limits, GitHub token.

类型
模型
服务商
GitHub Models
模型 ID
openai/gpt-4.1-mini
价格
免费 + 付费
无需密钥访问
否
密钥环境变量
GITHUB_TOKEN
Base URL(兼容 OpenAI)
https://models.github.ai/inference
输入
文本
开发者评分
暂无评分
文档
https://github.com/marketplace/models

代码示例

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":"你好,请用一句话介绍你自己。"}]}'

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": "你好,请用一句话介绍你自己。"}],
)
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: '你好,请用一句话介绍你自己。' }],
})
console.log(r.choices[0].message.content)

生成集成代码 →

热门搜索

常见问题

GitHub Models · openai/gpt-4.1-mini API 免费吗?

GitHub Models · openai/gpt-4.1-mini 提供有限的免费额度,超出部分需付费。

如何在代码中调用 GitHub Models · openai/gpt-4.1-mini?

GitHub Models · openai/gpt-4.1-mini 在 https://models.github.ai/inference 提供兼容 OpenAI 的 API:使用任意 OpenAI SDK(Python、JavaScript 等)并设置该基础 URL 即可。 模型标识:openai/gpt-4.1-mini。 开发者工具箱中提供了即用代码(流式输出、JSON、重试)。

GitHub Models · openai/gpt-4.1-mini 有哪些替代方案?

目录中的类似 API:gpt-oss-20b · AkashML, gpt-oss-20b · Amazon Bedrock, gpt-oss-20b · CoreWeave, gpt-oss-20b · Groq, gpt-oss-20b · Parasail。

替代方案