Consumption API
The Consumption API is what you call to run inference. Two surfaces (OpenAI Chat Completions and Anthropic Messages) sit in front of the same routing engine.
Create a chat completion
Creates a chat completion for the provided messages using the specified model. This endpoint is compatible with the OpenAI chat completions API format.
The request is validated and then routed to the appropriate LLM provider. Your account balance is checked before processing.
Bearer token authentication using your API key.
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Generate API keys from your Grid Dashboard.
text-prime111falsefalsetrue00Chat completion response
chatcmpl-abc1231677858242text-primeBad Request - Invalid parameters
Unauthorized - Invalid or missing API key
Not Found - Model not found
Validation Error
Rate Limit Exceeded
Internal Server Error
Service Unavailable - Balance replenishment in progress. Retry the request after a short delay.
Create a message (Anthropic-compatible)
Send a structured list of input messages and receive a model-generated response using the Anthropic-compatible Messages format. This is the endpoint that powers Claude Code.
This endpoint is in beta and is served from its own dedicated base URL https://messages-beta.api.thegrid.ai/v1.
This endpoint authenticates via the x-api-key header (not Authorization: Bearer), matching the Anthropic API convention.
For a step-by-step Claude Code setup guide, see Use The Grid in Claude Code.
Anthropic-compatible API key authentication for the [BETA] Messages endpoint.
Include your API key in the x-api-key header:
x-api-key: YOUR_API_KEY
Generate API keys from your Grid Dashboard.
text-prime1024falseMessage response
msg_01XFDUDYJgAACzvnptvVoYELtext-primeBad Request - Invalid parameters
Unauthorized - Invalid or missing API key
Not Found - Model not found
Validation Error
Rate Limit Exceeded
Internal Server Error
Service Unavailable - Balance replenishing
Quick example
Where next
Last updated
Was this helpful?