OpenAI logo
OpenAI

GPT-4.1 Nano

GPT-4.1 超轻量版本,极致性价比适合简单快速任务

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

定价与规格

💰 定价

输入$0.1 / M tokens
输出$0.4 / 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-nano",
    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-nano",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'