LLM Gatewaydocs
Documentation

The intelligent infrastructure layer for AI inference.

One API, one key, one bill. The gateway speaks the OpenAI wire format and routes each request across multiple providers and models with automatic fallback, streaming, cost accounting and observability.

Base URL https://api.smartapihub.com/v1
first request
curl https://api.smartapihub.com/v1/chat/completions \
  -H "Authorization: Bearer $LLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}'
OpenAI-compatible

Point the official openai SDK at the gateway. Same request and response shapes, plus a few X-LLM-* extras.

Routing & fallback

Every request is routed across providers by priority, cost, latency or availability, with retries and fallback before the first token.

Streaming

Standard SSE with ping comments, a guaranteed final usage chunk and a documented mid-stream error shape.

Every modality

Chat, responses, embeddings, images, speech, transcription — plus async video and music jobs with webhooks.

One bill, one key

Integer micro-USD pricing, discounts and per-key budgets. Cost is returned on every response.

Secure by default

Hashed keys, IP allow-lists, SSRF-guarded URLs, signed webhooks, secrets never logged.

Browse the documentation

Getting started
Text
Media
  • Image Generation
    Generations and edits, response formats, signed URLs.
  • Audio
    Speech synthesis streaming and transcriptions.
  • Video
    Async jobs: 202, polling, cancel, webhooks, state machine.
  • Music
    Async music generation jobs.
Platform
  • Routing
    Strategies, per-request override, decision exposure.
  • Fallbacks
    Retryable vs non-retryable, backoff, streaming rule.
  • Rate Limits
    Scopes, headers, backing off.
  • Pricing
    Micro-USD, list vs discount vs charged, savings.
  • API Keys
    Key management concepts, limits, budgets, 402 vs 429.
  • Errors
    The envelope and every error code.
Reference
  • SDK Examples
    curl, TypeScript, Python, raw fetch/requests streaming.
  • OpenAPI
    Interactive reference and endpoint index.