AI Explore.Source.Templates

One HTML document for Search, AI answers, and browser agents.

Switch to Simplified Chinese

How to apply for the xAI API

  • 高森 Model product
  • 齐岚 Developer experience

Published September 20, 2026

The xAI API lives in console.x.ai (or the console docs name). Register an organization, attach billing, mint an API key. The surface is OpenAI-SDK compatible: Base URL https://api.x.ai/v1, secret in XAI_API_KEY. X Premium is not API credit. SSO, residency, and invoices are enterprise quotes, not the personal console. Title, H1, and this paragraph answer where the key comes from and where the first request goes.

  • console.x.ai Console
  • https://api.x.ai/v1 Base URL
  • XAI_API_KEY Env

Fan-out: waitlists, Azure, leftover free tiers.

Apply in order#

  • Open the xAI console and create a team / org.
  • Attach payment; usage is per million tokens.
  • Create an API key once, store it in a vault.
  • Export XAI_API_KEY locally; never commit it.

How the compatibility layer points#

Official guidance covers OpenAI and Anthropic SDKs. Migration is usually a key, a Base URL, and grok-4.6 or grok-4.3. Streaming and tools still work. Azure Foundry is a different bill—do not mix keys.

Limits and refusals#

New accounts start slow and rise with spend. Back off on 429; a sibling key in the same org will not help. Console refusals are usually billing or region policy, not “another email.”

Takeaways#

  • Console key; API ≠ Premium.
  • Base URL stays api.x.ai/v1.
  • Cloud-marketplace deploys use their own console.

Was this helpful?

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. Figures are original to this site.

Last updated 2026-09-20.