SPM SPM Docs

Provider proxy API

Base URL: https://api.spmos.ai

All endpoints except health require Authorization: Bearer spm_live_... (or x-api-key for the Anthropic dialect).

Chat Completions

POST /v1/chat/completions — a drop-in endpoint for the OpenAI Chat Completions API.

{
  "model": "deepseek-chat",
  "messages": [{"role": "user", "content": "What did we decide about the deploy window?"}],
  "stream": true
}

Streaming passes through provider chunks as they are emitted while SPM observes usage and completion in parallel.

Responses

POST /v1/responses — OpenAI Responses API dialect.

Messages

POST /v1/messages — Anthropic Messages dialect. Send Anthropic model names and payload shapes; they are forwarded natively.

Request receipts

Every request writes a signed receipt: protocol, model, token usage (original vs forwarded input, recalled memory tokens, output), latency, and status.

GET /v1/spm/requests?limit=50        # list (requires receipt:read)
GET /v1/spm/requests/{receipt_id}    # single receipt

Receipts are the source of truth for billing and debugging. The recalled-token field records exactly what SPM added to the prompt.

Health

GET /health, GET /livez, GET /readyz — no auth, for load balancers and monitors.

Errors

HTTP Code Meaning
401 auth Missing, malformed, or revoked key
403 scope Key lacks the required scope
429 quota Tenant quota or rate budget exceeded — back off
503 RATE_LIMITER_UNAVAILABLE The distributed limiter is down; SPM fails closed rather than dropping your rate limits
5xx upstream Provider errors are mapped through with their original status

Retry 429 and 503 responses with exponential backoff. Requests are idempotent at the memory layer, so a retried response never writes memory twice.