xAI (Grok)
xAI's Grok models with real-time knowledge and deep thinking.
Overview
xAI is an AI company founded by Elon Musk, offering Grok models with real-time knowledge access and strong reasoning capabilities.
Official Website: https://x.ai API Documentation: https://docs.x.ai
Key Features
- Real-Time Knowledge — Access to current information
- Deep Thinking — Extended reasoning for complex problems
- Long Context — Large context windows
- Structured Output — JSON and structured responses
- Function Calling — Tool use support
Usage Example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.yuhuanstudio.com/v1"
)
response = client.chat.completions.create(
model="model-id",
messages=[{"role": "user", "content": "What's the latest news?"}]
)
print(response.choices[0].message.content)Available Models
Use the Models API to query available models:
curl https://api.yuhuanstudio.com/v1/models?provider=xai \
-H "Authorization: Bearer YOUR_API_KEY"Models and pricing are synced automatically from xAI. Check the dashboard for current availability and rates.
Official Resources
How is this guide?