API Overview
The SandBase API is a RESTful API at https://api.sandbase.ai that provides programmatic access to 1400+ AI models and Managed Agents.
New to SandBase?
For direct model access, start with Get started and Models. For managed agent infrastructure, see the Managed Agents quickstart.
Prerequisites
To use the SandBase API, you'll need:
- A SandBase account
- An API key (starts with
sk-sb-)
For step-by-step setup instructions, see Get started.
Available APIs
The SandBase API includes the following:
General Availability
- Chat Completions API: OpenAI-compatible endpoint for 1400+ models (
POST /v1/chat/completions) - Messages API: Anthropic-compatible endpoint (
POST /v1/messages) - Models API: Browse and query the model catalog (
GET /api/models) - Sandbox API: Cloud execution environments (
POST /sandboxes)
Managed Agents
- Agents API: Create and manage agent configurations (
POST /v1/agents) - Sessions API: Run agent sessions (
POST /v1/sessions) - Events API: Send messages and stream responses (
POST /v1/sessions/:id/events) - Environments API: Configure execution environments (
POST /v1/environments)
Authentication
Getting API keys
Create API keys in the Console. Keys use the sk-sb- prefix.
Using API keys
Include your key in the Authorization header:
Authorization: Bearer sk-sb-YOUR_API_KEYOr use the x-api-key header (Anthropic-style):
x-api-key: sk-sb-YOUR_API_KEYWARNING
Never share your API key or commit it to version control. Use environment variables instead.
Client SDKs
SandBase is compatible with existing SDKs — no custom SDK needed:
| Use Case | SDK | Configuration |
|---|---|---|
| LLM (Chat Completions) | OpenAI Python/JS | base_url="https://api.sandbase.ai/v1" |
| Anthropic Messages | Anthropic Python/JS | base_url="https://api.sandbase.ai" |
| Managed Agents | Anthropic Python/JS | base_url="https://api.sandbase.ai" |
| Sandboxes | E2B Python/JS | api_url="https://api.sandbase.ai" |
from openai import OpenAI
client = OpenAI(
api_key="sk-sb-YOUR_KEY",
base_url="https://api.sandbase.ai/v1"
)from anthropic import Anthropic
client = Anthropic(
api_key="sk-sb-YOUR_KEY",
base_url="https://api.sandbase.ai"
)import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-sb-YOUR_KEY',
baseURL: 'https://api.sandbase.ai/v1',
});import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
apiKey: 'sk-sb-YOUR_KEY',
baseURL: 'https://api.sandbase.ai',
});Request and response format
Content types
Content-Type: application/jsonResponses are returned as:
application/json— for non-streaming responsestext/event-stream— for streaming responses (SSE)
Request size limits
| Limit | Value |
|---|---|
| Max request body | 10 MB |
| Max messages array | 1000 messages |
| Max system prompt | 100,000 characters |
Response headers
Every response includes a request identifier for tracing and support:
X-Request-ID: req_01abc...INFO
SandBase does not emit X-RateLimit-* or Retry-After headers. You cannot read remaining quota from response headers.
Rate limits and availability
Rate limits
Limits are enforced as a 1-minute sliding window across two layers: a platform-wide global cap and an optional per-key request cap. There are no named tiers; published limit values are pending — see the full rate limits documentation.
When rate limited, the API returns 429 Too Many Requests with a flat {"error": "..."} body and no Retry-After header. Use client-side exponential backoff.
→ Full rate limits documentation
Availability
SandBase maintains 99.99% uptime through:
- Multi-provider failover (if one provider is down, traffic shifts automatically)
- Global edge routing
- Health-check based load balancing
Error format
All errors follow a consistent structure:
{
"error": {
"type": "invalid_request_error",
"message": "model field is required"
}
}| Error Type | HTTP Status | Description |
|---|---|---|
invalid_request_error | 400 | Malformed request |
authentication_error | 401 | Invalid or missing API key |
permission_error | 403 | Key doesn't have access |
not_found_error | 404 | Resource not found |
rate_limit_error | 429 | Too many requests |
server_error | 500 | Internal error |
OpenAPI Specification
The full OpenAPI 3.1 spec is available for import into Postman, SDK generators, or API tools:
https://www.sandbase.ai/docs/openapi.yamlNext steps
- Chat Completions — LLM Gateway endpoint reference
- Create Agent — Managed Agents API
- Supported Models — Browse 1400+ models
- Quickstart — Make your first call

