Skip to content

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:

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:

http
Authorization: Bearer sk-sb-YOUR_API_KEY

Or use the x-api-key header (Anthropic-style):

http
x-api-key: sk-sb-YOUR_API_KEY

WARNING

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 CaseSDKConfiguration
LLM (Chat Completions)OpenAI Python/JSbase_url="https://api.sandbase.ai/v1"
Anthropic MessagesAnthropic Python/JSbase_url="https://api.sandbase.ai"
Managed AgentsAnthropic Python/JSbase_url="https://api.sandbase.ai"
SandboxesE2B Python/JSapi_url="https://api.sandbase.ai"
python
from openai import OpenAI

client = OpenAI(
    api_key="sk-sb-YOUR_KEY",
    base_url="https://api.sandbase.ai/v1"
)
python
from anthropic import Anthropic

client = Anthropic(
    api_key="sk-sb-YOUR_KEY",
    base_url="https://api.sandbase.ai"
)
typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'sk-sb-YOUR_KEY',
  baseURL: 'https://api.sandbase.ai/v1',
});
typescript
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/json

Responses are returned as:

  • application/json — for non-streaming responses
  • text/event-stream — for streaming responses (SSE)

Request size limits

LimitValue
Max request body10 MB
Max messages array1000 messages
Max system prompt100,000 characters

Response headers

Every response includes a request identifier for tracing and support:

http
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:

json
{
  "error": {
    "type": "invalid_request_error",
    "message": "model field is required"
  }
}
Error TypeHTTP StatusDescription
invalid_request_error400Malformed request
authentication_error401Invalid or missing API key
permission_error403Key doesn't have access
not_found_error404Resource not found
rate_limit_error429Too many requests
server_error500Internal error

Full error reference

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.yaml

Next steps