API reference

Two surfaces. The proxy at /v1/* is OpenAI-compatible and authenticated by API key. The management API at /api/* drives the dashboard and accepts session or API-key auth.

Base URLs

  • REST gateway: https://api.edgerouteai.com
  • MCP server: https://mcp.edgerouteai.com
  • Dashboard / management: https://api.edgerouteai.com/api

Proxy endpoints

POST /v1/chat/completions

OpenAI-compatible chat completions. Streaming is on by default. Notable knobs:

  • model — any of the 11 supported provider/model strings, or auto / auto/quality / auto/balanced / auto/budget / auto/auto.
  • Standard params (temperature, max_tokens, stream, etc.) pass through unchanged.

Response sets these EdgeRoute-specific headers:

X-EdgeRoute-Trace-Id:    <uuid>
X-EdgeRoute-Provider:    openai | anthropic | …
X-EdgeRoute-Model:       gpt-5 | claude-sonnet-4-6 | …
X-EdgeRoute-Auto-Reason: <human-readable reason if model=auto>
X-EdgeRoute-Cache:       HIT | MISS

Management endpoints

All /api/* routes accept session cookie OR Authorization: Bearer API key. JSON in, JSON out. Errors share a structured shape:

{ "error": { "type": "edgeroute_error", "code": "<code>", "message": "<msg>" } }

Catalog

  • GET/POST/DELETE /api/keys — manage API keys.
  • GET/POST/DELETE /api/providers — BYOK provider keys.
  • POST /api/providers/:id/verify — sanity-check a key against the upstream.
  • GET/POST/PUT/DELETE /api/routing — fallback chains.
  • GET/PUT/DELETE /api/router-prefs — smart-router pin/exclude/¢-cap (per-user / per-key).
  • GET/POST/DELETE /api/aliases — model aliases.
  • GET/POST/PUT/DELETE /api/budgets — monthly $ budgets per API key.
  • GET/POST/PUT/DELETE /api/webhooks — outbound webhooks.
  • GET/POST/PUT/DELETE /api/transforms — request transforms (prepend/append system, set parameter).
  • GET/POST/PUT/DELETE /api/guardrails — input-scope guardrails per key.
  • GET /api/stats, GET /api/analytics, GET /api/logs — usage data.
  • GET /api/export/stats?format=csv&days=N — CSV export.
  • GET /api/account — current user, credit balance.
  • GET/POST /api/admin/* — superadmin only.

Error codes

  • invalid_api_key — bad / revoked key.
  • rate_limited — per-key RPM exceeded.
  • budget_exceeded — monthly $ ceiling hit.
  • insufficient_credits — platform-key path, balance ≤ 0.
  • provider_key_missing — auto-router has no key for the chosen provider.
  • model_not_found — unknown model string.
  • guardrail_blocked — request matched an active guardrail.