OpenAI
GPT-5.4
OpenAI 2026 最新旗舰模型,支持 400K 上下文与缓存命中计费,兼顾推理、代码与多模态理解
上下文长度1M tokens
模型类型大语言模型 (LLM)
多模态支持文本与图像输入,文本输出
定价与规格
💰 定价
输入$2.5 / M tokens
输出$15 / M tokens
缓存命中$0.25 / M tokens
⚙️ 规格
上下文长度1M tokens
模型类型大语言模型 (LLM)
多模态支持文本与图像输入,文本输出
缓存支持支持缓存命中计费(Cached Input)
模型快照gpt-5.4-2026-02-20
训练截止日期2024年6月
API 调用示例
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="https://api.xairouter.com/v1"
)
response = client.chat.completions.create(
model="gpt-5.4",
messages=[
{"role": "user", "content": "请帮我总结这段需求并拆成开发任务"}
]
)
print(response.choices[0].message.content)cURL (OpenAI API)
curl https://api.xairouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-5.4",
"messages": [
{"role": "user", "content": "请帮我总结这段需求并拆成开发任务"}
]
}'开发者辅助
# 配置 ~/.codex/config.toml
cat > ~/.codex/config.toml << 'EOF'
model_provider = "xai"
model = "gpt-5.4"
model_reasoning_effort = "xhigh"
plan_mode_reasoning_effort = "xhigh"
model_reasoning_summary = "none"
model_verbosity = "medium"
model_context_window = 1050000
model_auto_compact_token_limit = 945000
tool_output_token_limit = 6000
approval_policy = "never"
sandbox_mode = "danger-full-access"
suppress_unstable_features_warning = true
[model_providers.xai]
name = "OpenAI"
base_url = "https://api.xairouter.com"
wire_api = "responses"
requires_openai_auth = false
env_key = "XAI_API_KEY"
[features]
multi_agent = true
[agents]
max_threads = 4
max_depth = 1
job_max_runtime_seconds = 1800
EOF
# 设置环境变量 (添加到 ~/.bashrc 或 ~/.zshrc)
export XAI_API_KEY="sk-Xvs..."
# 启动 Codex
codex