Skip to content

Agent-Friendly API Overview

Session contract

session_id is the public identity for persistent Agent interaction. Direct Session creation and Service (Endpoint) invocation create or continue that Session. Every Schedule (Deployment) trigger creates a separate public drun_* DeploymentRun and attempts to create one new Session. Runtime instances remain internal and are never returned.

A concise reference for both humans and AI agents. For plain-text versions optimized for LLM ingestion, see llms.txt.

What is SandBase?

SandBase is an AI agent infrastructure platform. One API key gives you access to 400+ models (LLM, image, video, audio, embedding), sandboxed environments, and agent workflows.

API Base URL

https://api.sandbase.ai/v1

Authentication

All requests require a Bearer token:

Authorization: Bearer sk-sb-YOUR_KEY

Get your key at Console → API Keys.

Quick Example

bash
curl https://api.sandbase.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-sb-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Core Endpoints

MethodEndpointDescription
POST/v1/chat/completionsOpenAI-compatible chat (LLM, vision, tools, streaming)
POST/v1/messagesAnthropic-compatible messages API
POST/v1/embeddingsGenerate text embeddings
POST/v1/runUnified generation (image, video, audio, any async task)
GET/v1/run/{id}Poll async generation status and retrieve results
GET/v1/modelsList all available models
GET/v1/models/{name}Get model details + pricing
GET/v1/tasks/{id}/costGet task cost and usage

Additional Endpoint Groups

Beyond the core generation endpoints, SandBase provides full APIs for agent lifecycle management. See the Complete API Reference for full request/response details.

GroupKey EndpointsPurpose
AgentsPOST /v1/agents, GET /v1/agents, POST /v1/agents/{id}Create and manage agent definitions
Services (Endpoints)POST /v1/endpoints/{id}/runInvoke a Service and create or continue a Session
SessionsPOST /v1/sessions, POST /v1/sessions/{id}/eventsCreate persistent Agent Sessions and send messages
Schedules (Deployments)POST /v1/deploymentsDefine manual or cron triggers; each creates a DeploymentRun
Skills & WebhooksGET /v1/skills, POST /events/webhooksExtend agent capabilities and register callbacks

Pricing Model

Pay-per-use. Each model has a price_formula field:

  • LLM: input_tokens × prompt_price + output_tokens × completion_price
  • Image/Video/Audio: flat base_price per generation
  • Cached tokens: significantly discounted (Anthropic 90% off, OpenAI 50% off, Google 75% off)

Check cost after any generation:

bash
curl https://api.sandbase.ai/v1/tasks/{task_id}/cost \
  -H "Authorization: Bearer sk-sb-YOUR_KEY"

Rate Limits

Default: 60 requests/min, 5 concurrent. Upgrade plans have higher limits. See Error Codes for handling 429 responses.


Further Reading

Plain-Text Versions (for AI agents)

FileURLContent
llms.txt/docs/llms.txtCompact summary (~60 lines)
llms-full.txt/docs/llms-full.txtComplete reference (all endpoints + models + pricing)
openapi.yaml/docs/openapi.yamlOpenAPI 3.1 machine-readable spec