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.
https://api.smartapihub.com/v1curl 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"}]}'Point the official openai SDK at the gateway. Same request and response shapes, plus a few X-LLM-* extras.
Every request is routed across providers by priority, cost, latency or availability, with retries and fallback before the first token.
Standard SSE with ping comments, a guaranteed final usage chunk and a documented mid-stream error shape.
Chat, responses, embeddings, images, speech, transcription — plus async video and music jobs with webhooks.
Integer micro-USD pricing, discounts and per-key budgets. Cost is returned on every response.
Hashed keys, IP allow-lists, SSRF-guarded URLs, signed webhooks, secrets never logged.
Browse the documentation
- Quick StartGet a key, make a chat completion, stream, switch model.
- AuthenticationBearer keys, scopes, budgets, expiry and rotation.
- ModelsList models, pricing fields, capabilities, id format.
- Migrating from OpenAIChange baseURL, key and model id.
- Chat CompletionsRequest fields, routing extension, response and headers.
- ResponsespartialSupported subset of the Responses API.
- StreamingSSE wire format, usage chunk, errors, fallback rules.
- EmbeddingsVector embeddings, OpenAI shape.
- Image GenerationGenerations and edits, response formats, signed URLs.
- AudioSpeech synthesis streaming and transcriptions.
- VideoAsync jobs: 202, polling, cancel, webhooks, state machine.
- MusicAsync music generation jobs.
- RoutingStrategies, per-request override, decision exposure.
- FallbacksRetryable vs non-retryable, backoff, streaming rule.
- Rate LimitsScopes, headers, backing off.
- PricingMicro-USD, list vs discount vs charged, savings.
- API KeysKey management concepts, limits, budgets, 402 vs 429.
- ErrorsThe envelope and every error code.
- SDK Examplescurl, TypeScript, Python, raw fetch/requests streaming.
- OpenAPIInteractive reference and endpoint index.