AI Stats Gateway
Use this skill to make high-confidence AI Stats integration changes with minimal diff size.
Workflow
- •Identify integration surface before editing:
- •OpenAI-compatible REST calls
- •OpenAI SDK / Anthropic SDK pointed at AI Stats
- •Official AI Stats SDK (TS/Python)
- •Vercel AI SDK provider (
@ai-stats/ai-sdk-provider)
- •Select the minimal migration path:
- •Keep existing SDK and only swap
baseURL+ API key when possible. - •Move to official AI Stats SDK only when explicit capability gaps or ergonomics need it.
- •Apply standard AI Stats request contract:
- •Base URL:
https://api.phaseo.app - •Auth header:
Authorization: Bearer <AI_STATS_API_KEY> - •Optional attribution headers:
x-titleandhttp-referer - •Discover model IDs from
GET /v1/modelsrather than hard-coding stale IDs
- •Validate quickly:
- •
GET /v1/healthfor gateway reachability - •
GET /v1/modelsfor model availability/capabilities - •One smoke generation request on the target endpoint
- •Harden before finishing:
- •Move keys into env vars if found inline.
- •Keep API keys out of commits, logs, screenshots, and client-side bundles.
- •Add retries/backoff for 429 and 5xx responses.
Integration Playbooks
- •OpenAI-compatible REST: read
references/rest.md - •TypeScript SDK: read
references/sdk-typescript.md - •Python SDK: read
references/sdk-python.md - •Migration patterns (OpenAI, Anthropic, OpenRouter, Vercel AI Gateway): read
references/migrations.md
Execution Rules
- •Prefer minimal and reversible changes.
- •Preserve response shapes expected by callers unless explicitly requested to refactor.
- •If model IDs differ between platforms, map through
/v1/modelsand keep compatibility aliases where needed. - •If the user asks for best-effort migration, prioritize working endpoint and auth first, then feature parity.