API Reference

API Reference

This reference contains only stable, customer-facing APIs. All APIs share one service endpoint. Every request except public pricing requires an API Key.

export BASE_URL="https://api.yairouter.com"
export API_KEY="sk-Xvs..."

Choose a guide

  • Router API Call models and query available models, pricing, and account status.

  • Usage API Query live usage, historical trends, model details, and descendant rankings.

  • Account API Manage API accounts, credits, and access limits.

  • Provider Key API Add and manage upstream Provider Keys for OpenAI, Anthropic, Gemini, and other services.

Minimal example

curl "$BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5-nano",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Conventions

  • Authenticate with Authorization: Bearer <API_KEY>.
  • Requests and responses use UTF-8 JSON; file uploads use multipart/form-data.
  • Dates use YYYY-MM-DD; timestamps use RFC 3339.
  • Only paths and fields listed in this reference are part of the public compatibility contract.
  • Store API Keys only on a server or in a secure secret manager.