SONICHAOS · Documentation

Build on the Sonichaos API

One OpenAI-compatible gateway for chat at /v1, and a platform API at /api for projects, sessions, missions and billing.

Instead of choosing a model and managing prompts, teams define the outcome. SONICHAOS plans the work, assembles a specialized AI workforce, selects the right models and compute, executes the mission, verifies the result and continuously learns from the organization.

Install

There is no Sonichaos SDK to install. The gateway speaks the OpenAI wire format, so your existing OpenAI client works unchanged — you only change the base URL and the key.

npm install openai
# or
pip install openai

Quickstart

1. Get an API key

An organisation admin mints keys with POST /api/apikeys. The raw key is returned once; the server keeps only a hash.

curl https://sonichaos.ai/api/apikeys \
  -H "Authorization: Bearer $SONICHAOS_SESSION" \
  -H "Content-Type: application/json" \
  -d '{"name":"quickstart"}'

# → { "id": "key_…", "name": "quickstart", "prefix": "sk_live_…", "key": "sk_live_…" }
2. Set the base URL

Point your client at https://sonichaos.ai/v1 for chat, and https://sonichaos.ai/api for the control API.

3. Make your first chat call

Any model id returned by GET /v1/models works. Streaming is supported with stream: true.

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.SONICHAOS_API_KEY,
  baseURL: "https://sonichaos.ai/v1",
});

const chat = await client.chat.completions.create({
  model: "gpt-4o", // any id from GET /v1/models
  messages: [{ role: "user", content: "Say hello in one word." }],
  max_tokens: 16,
});

console.log(chat.choices[0].message.content);

Or with curl:

curl https://sonichaos.ai/v1/chat/completions \
  -H "Authorization: Bearer $SONICHAOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Say hello in one word."}],"max_tokens":16}'

API reference

Two surfaces, one credential model. Both authenticate with Authorization: Bearer <token> — the gateway takes an API key or a sandbox token, and the platform API takes a session token.

OpenAI-compatible gateway · /v1
GET/v1/models
List the models this gateway can relay.
POST/v1/chat/completions
Chat completions, streaming included; metered and capped per organisation.
Platform API · /api
Projects & files
GET/api/projects
List the organisation's projects.
POST/api/projects
Create a project.
PATCH/api/projects/:id
Update a project.
DELETE/api/projects/:id
Delete a project (admin).
POST/api/projects/:id/sandbox-token
Mint a token for a sandbox.
GET/api/projects/:id/files
List project files.
PUT/api/projects/:id/files/*path
Upload a file.
GET/api/projects/:id/files/*path
Download a file.
DELETE/api/projects/:id/files/*path
Delete a file.
POST/api/projects/:id/files-presign/*path
Presign an upload/download.
Sessions & missions

JSON-RPC methods on the WebSocket at /ws, not REST paths.

RPCsession.list
List sessions.
RPCsession.create
Start a session.
RPCsession.open
Reopen a session.
RPCsession.send
Send a message.
RPCsession.edit
Edit a turn.
RPCsession.stop
Stop a running session.
RPCsession.approve
Approve or deny an action.
RPCsession.delete
Delete a session.
RPCmission.list
List missions.
RPCmission.get
Get one mission.
RPCmission.create
Create a mission.
RPCmission.cancel
Cancel a mission.
RPCmission.reset
Reset a mission.
RPCworkforce.list
List workforces.
RPCestimate.propose
Propose an estimate.
Billing & usage
GET/api/billing
Current balance and spend.
POST/api/billing/checkout
Start a Stripe checkout (admin).
POST/api/billing/webhook
Stripe webhook (signature-authenticated).
GET/api/usage
Metered usage.
POST/api/usage/limit
Set the org spend cap (admin).
Identity & orgs
GET/api/me
The current account.
GET/api/me/export
Export account data.
DELETE/api/me
Delete the account.
GET/api/orgs
List organisations.
POST/api/orgs
Create an organisation.
GET/api/orgs/members
List members.
POST/api/orgs/members
Add a member.
PATCH/api/orgs/members/:userId
Set a member's role.
DELETE/api/orgs/members/:userId
Remove a member.
POST/api/apikeys
Create an API key (admin).
GET/api/apikeys
List API keys (admin).
DELETE/api/apikeys/:id
Revoke an API key (admin).
Auth
POST/api/auth/signup
Create an account.
POST/api/auth/signin
Sign in.
POST/api/auth/refresh
Refresh a session.
POST/api/auth/signout
Sign out.
POST/api/auth/switch-org
Switch organisation.
POST/api/waitlist
Join the waitlist (no auth).
Events, analytics & more
GET/api/events
SSE stream of project events.
GET/api/analytics
Aggregated usage analytics.
GET/api/decisions
Routing decisions.
GET/api/audit
Audit log (admin).
GET/api/healthz
Liveness probe.
POST/api/ws/ticket
Mint a WebSocket upgrade ticket.
GET/api/personal
Personal context.
GET/api/hf/search
Search Hugging Face models.
GET/api/hf/models/:id
Hugging Face model info.
POST/api/projects/:id/hf/download
Download a model into a project.