OpenAI
GPT-4.1
OpenAI GPT-4 系列升级版,在推理和创意任务上表现优异
上下文长度128K tokens
模型类型大语言模型 (LLM)
特色能力增强推理能力
定价与规格
💰 定价
输入$2.0 / M tokens
输出$8.0 / 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",
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",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'