此测试页面可帮助您验证 Grok API 的连接和响应。成功测试后,您可以在写作助手中使用相同的 API 密钥。
本示例使用了如下 Grok API 格式:
curl https://api.x.ai/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer xai-YOUR_API_KEY" -d '{ "messages": [ { "role": "system", "content": "You are a test assistant." }, { "role": "user", "content": "Testing. Just say hi and hello world and nothing else." } ], "model": "grok-2-latest", "stream": false, "temperature": 0 }'