Quickstart
Get from sign-up to your first API call.
From sign-up to first call
Sign up at thegrid.ai.
Get an API key. Go to Settings → API Keys in the dashboard and create a Consumption API key. Copy it now. We don't show it after this. For agents and automation, create keys via the Platform API instead.
Check your balance. Make sure your account has sufficient credits before making an inference request. Add credits at app.thegrid.ai if needed.
Make your first call. Pick the API surface your code already speaks.
Make your first call
The Grid is compatible with both OpenAI and Anthropic messaging formats. The same Grid API key and instrument strings work on both. We route your request to the supplier offering the best price for that instrument.
OpenAI Chat Completions
Base URL: https://api.thegrid.ai/v1. Auth header: Authorization: Bearer YOUR_GRID_API_KEY. Model field: an instrument string like text-prime (Text Prime).
curl https://api.thegrid.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_GRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-prime",
"messages": [
{"role": "user", "content": "What is a spot market for AI inference?"}
]
}'from openai import OpenAI
client = OpenAI(base_url="https://api.thegrid.ai/v1", api_key="YOUR_GRID_API_KEY")
response = client.chat.completions.create(
model="text-prime",
messages=[{"role": "user", "content": "What is a spot market for AI inference?"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.thegrid.ai/v1",
apiKey: "YOUR_GRID_API_KEY",
});
const response = await client.chat.completions.create({
model: "text-prime",
messages: [
{ role: "user", content: "What is a spot market for AI inference?" },
],
});
console.log(response.choices[0].message.content);Anthropic Messages (beta)
Base URL: https://messages-beta.api.thegrid.ai/v1. Auth header: x-api-key: YOUR_GRID_API_KEY. Model field: an instrument string like text-prime.
That's it. You're live on The Grid. By default, your account runs in Auto Mode, so we handle token purchasing in the background as you call the API. We charge against your credit balance per request. You can configure optional auto-reload in the dashboard to top up your balance when it runs low.
What to do next
Read Choose an instrument before routing production traffic. For the full list, see Current Instruments.
Add a payment method and configure auto-reload in Auto Mode vs Advanced Mode.
To place orders directly on the order book, see Advanced Mode.
Last updated
Was this helpful?