Grok status: All systems operational
Quick fix

Grok API returns 401 Unauthorized

Updated Aug 13, 2026

Quick fix

  1. Confirm the header is Authorization: Bearer <your-key> — not api-key.
  2. Regenerate the key in the xAI console; keys revoked by a team member fail silently.
  3. Make sure the key belongs to a team with credits available.
  4. Strip whitespace and newlines from the key when loading from an env file.
  5. Point requests at https://api.x.ai/v1, not an OpenAI base URL.