TL;DR โ Switch in Under 5 Minutes
- xAI's API is already OpenAI-compatible โ change baseURL only
- Grok 2, Grok 3, Grok 3 Mini, Grok Vision all available on Railwail
- EU-hosted, EUR billing
- Plus access to Claude, GPT-4o, Gemini, Llama through the same key
- Same streaming, tool calling, vision behaviour
Why Move Off xAI Grok Console?
xAI's Grok models are competitive on reasoning and have unique X/Twitter integration. The constraints: US-only routing, USD billing, narrow catalog (Grok only), and no closed-source alternatives in the same account. Railwail mirrors Grok via the OpenAI-compatible schema and adds the rest of the market.
Step 1 โ Get a Railwail API Key
Sign up at railwail.com and generate a key.
Sponsored
Access 100+ AI Models with One API Key
GPT-4o, Claude, Gemini, Llama, Flux, DALL-E and more โ all through a single, OpenAI-compatible endpoint. No more juggling multiple providers.
Step 2 โ Change Base URL
TypeScript / JavaScript
Before (xAI):
import OpenAI from "openai";
const xai = new OpenAI({
apiKey: process.env.XAI_API_KEY,
baseURL: "https://api.x.ai/v1",
});
const res = await xai.chat.completions.create({
model: "grok-3",
messages: [{ role: "user", content: "Hello" }],
});After (Railwail):import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.RAILWAIL_API_KEY,
baseURL: "https://api.railwail.com/v1",
});
const res = await client.chat.completions.create({
model: "grok-3",
messages: [{ role: "user", content: "Hello" }],
});Python
from openai import OpenAI
client = OpenAI(
api_key=os.environ["RAILWAIL_API_KEY"],
base_url="https://api.railwail.com/v1",
)
resp = client.chat.completions.create(
model="grok-3",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)cURL
curl https://api.railwail.com/v1/chat/completions \
-H "Authorization: Bearer $RAILWAIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-3",
"messages": [{"role": "user", "content": "Hello"}]
}'API Endpoint Mapping
xAI endpoint โ Railwail equivalent
| xAI Console | Railwail | Notes |
|---|---|---|
| POST /v1/chat/completions | POST /v1/chat/completions | Identical |
| POST /v1/completions (legacy) | POST /v1/completions | Legacy |
| POST /v1/images/generations (Grok image) | POST /v1/images/generations | Grok-Image |
| GET /v1/models | GET /v1/models | 275+ models |
Model Mapping
xAI model โ Railwail
| xAI Console | Railwail | Notes |
|---|---|---|
| grok-2 | grok-2 | Same |
| grok-2-vision | grok-2-vision | Vision |
| grok-2-mini | grok-2-mini | Smaller |
| grok-3 | grok-3 | Frontier |
| grok-3-mini | grok-3-mini | Smaller frontier |
| grok-3-fast | grok-3-fast | Latency-optimised |
| grok-3-mini-fast | grok-3-mini-fast | Cheapest |
| grok-3-vision | grok-3-vision | Frontier vision |
| grok-image-1 | grok-image-1 | Image generation |
Sponsored
Test Any AI Model Instantly
Our built-in playground lets you compare models side by side. Find the perfect model for your use case in minutes, not days.
Pricing Comparison (per 1M tokens, May 2026)
Same Grok model, Railwail in EUR
| Model | xAI direct (USD) | Railwail (EUR) | Notes |
|---|---|---|---|
| grok-3 input | $3.00 | EUR 2.76 | Identical |
| grok-3 output | $15.00 | EUR 13.80 | Identical |
| grok-3-mini input | $0.30 | EUR 0.28 | Identical |
| grok-3-mini output | $0.50 | EUR 0.46 | Identical |
| grok-3-fast input | $5.00 | EUR 4.60 | Identical |
| grok-3-fast output | $25.00 | EUR 23.00 | Identical |
| grok-2-vision input | $2.00 | EUR 1.84 | Identical |
Why Railwail Over xAI Console
- EU hosting and EUR billing
- Same OpenAI-compatible API โ no SDK to change
- Adds Claude, GPT-4o, Gemini, Llama, DeepSeek
- Built-in playground for A/B testing Grok vs alternatives
- Per-key rate limits and spend caps
- Unified VAT invoice
FAQ
Does Grok's live X/Twitter search work?
The live X-data retrieval mode is xAI-internal and not exposed via Railwail. For grounded responses, use Perplexity Sonar models on Railwail (perplexity-sonar-pro) for general web search grounding.
What about Grok's reasoning_effort parameter?
reasoning_effort (low / high) is forwarded to grok-3 models. Higher effort spends more tokens internally but produces better reasoning.
Is vision (image input) supported?
Yes. Pass content as an array with text and image_url blocks (OpenAI vision schema) to grok-2-vision or grok-3-vision.
Does Grok-Image (image generation) work?
Yes. POST /v1/images/generations with model=grok-image-1 returns generated images.
What about tool calling?
Standard OpenAI tools array works on Grok 3. tool_choice (auto / none / specific) is supported.
Sponsored
Pay Only for What You Use
Transparent per-token pricing with no monthly minimums. Start with free credits and scale as you grow.
Next Steps
- Sign up at railwail.com
- Generate an API key
- Update baseURL to https://api.railwail.com/v1
- Keep model strings unchanged
- Read the reference at railwail.com/docs
- Compare pricing at railwail.com/pricing