Skip to main content

xAI

Use this when your team already runs on xAI and you want that vendor family to stay explicit in Loong config instead of disappearing behind a generic compatibility route.

At A Glance

FieldValue
Built-in kindxai
Provider groupDirect Hosted Providers
Protocol familyopenai_chat_completions
Feature familyopenai_compatible
Auth schemebearer
Credential envsXAI_API_KEY
Aliasesxai_compatible, grok
Default base URLhttps://api.x.ai
Request endpointhttps://api.x.ai/v1/chat/completions
Models endpointhttps://api.x.ai/v1/language-models

Minimal Config

active_provider = "xai"

[providers.xai]
kind = "xai"
api_key = { env = "XAI_API_KEY" }
model = "auto"

Verify It

loong doctor
loong list-models
loong ask --message "Say hello and name the active provider."
If list-models is unreliable for this account or region, pin an explicit provider.model or add preferred_models instead of leaving recovery implicit.

Auth And Routing Contract

ContractValue
Auth optionalno
Model probe auth optionalno
Default API key envXAI_API_KEY
OAuth envnone
Primary request routehttps://api.x.ai/v1/chat/completions
Primary model-catalog routehttps://api.x.ai/v1/language-models