OpenAI logo
OpenAI

GPT-4.1 Mini

GPT-4.1 轻量版本,在保持优秀性能的同时更经济高效

类型 文本模型 Model ID gpt-4.1-mini
上下文长度128K tokens
模型类型大语言模型 (LLM)
特色能力高性价比

定价与规格

💰 定价

输入$0.4 / M tokens
输出$1.6 / M tokens

⚙️ 规格

上下文长度128K tokens
模型类型大语言模型 (LLM)
特色能力高性价比
训练截止日期2024年12月

API 调用示例

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://api.xairouter.com/v1",
    api_key="your-api-key"
)

response = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

print(response.choices[0].message.content)

cURL

curl https://api.xairouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4.1-mini",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'