科学上网用打开https://console.x.ai/,目前grok2屏蔽了国内,注册成功后每个月有25美元的免费额度
用国外的邮箱注册登录后创建一个apikey,然后就可以访问了
curl https://api.x.ai/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_XAI_API_KEY" \ -d '{ "messages": [ { "role": "system", "content": "You are Grok, a chatbot inspired by the Hitchhikers Guide to the Galaxy." }, { "role": "user", "content": "What is the meaning of life, the universe, and everything?" } ], "model": "grok-beta", "stream": false, "temperature": 0 }'
网友回复