Build on the ZephAI gateway
One OpenAI-compatible API for every model on the marketplace — staff-listed or vendor-supplied.
Quickstart
Make your first call in under a minute. No SDK required — any HTTP client works.
curl https://api.zephai.dev/v1/chat/completions \ -H "Authorization: Bearer $ZEPHAI_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "zeph-nexus-4", "messages": [{"role":"user","content":"Hello from ZephAI"}] }' # { "id": "cmpl_9f2ab41c", "choices": [...], "usage": { ... } }
pip install zephai
npm install zephai
go get github.com/zephai/zephai-go
1. Create a key
Console → API keys → Create. Scope it per environment.
2. Pick a model
Any listing ID from GET /v1/models.
3. Send a request
Chat, embeddings, images or audio — same auth.
Documentation library
Start with a guide, browse by category or search every published article. The same content powers the in-console help search.
Getting started documentation
3 artículos GatewayGateway documentation
4 artículos VendorsVendors documentation
3 artículos SDKs & toolsSDKs & tools documentation
3 artículosAuthentication
All requests use a bearer token in the Authorization header. Keys are scoped, rate-limited and carry an optional monthly spend cap enforced at the gateway.
Authorization: Bearer zph_live_•••••••••••••••• Content-Type: application/json X-Zephai-Key-Id: key_9f2a (optional, for mTLS setups)
| Key type | Prefix | Use | Rate limit default |
|---|---|---|---|
| Live | zph_live_ | Production traffic | 500 req/min |
| Test | zph_test_ | Staging & QA | 100 req/min |
| Development | zph_dev_ | Local work | 20 req/min |
| Vendor | vnd_live_ | Listing & telemetry API | 120 req/min |
Endpoints
Base URL: https://api.zephai.dev/v1. Every model — regardless of vendor — answers on the same routes.
/chat/completionsChat, vision, tools, streaming/responsesStateful responses API/embeddingsText embeddings & rerank/images/generationsText-to-image/audio/transcriptionsSpeech-to-text/batch24h deferred, 50% price/modelsCatalog with live pricing/usageMetered usage for your keysStreaming & tools
Set stream: true to receive server-sent events. Tool calls arrive as deltas you concatenate client-side; the gateway validates arguments against your JSON schema before delivery.
data: {"choices":[{"delta":{"content":"Stream"}}]} data: {"choices":[{"delta":{"content":"ing tokens…"}}]} data: {"choices":[{"delta":{"tool_calls":[{"function":{"name":"read_file"}}]}}]} data: {"usage":{"total_tokens":164}} data: [DONE]
Tool calling
- Up to 8 parallel tool calls per request on supported models.
- Strict mode (
tool_choice: "required") rejects malformed arguments with a typed error instead of a silent retry. - Vendor models that lack tool support return
400 unsupported_capabilitybefore billing starts.
Fallback & failover
Add "fallbacks": ["zeph-small-2"] to retry against another listing when the primary endpoint errors. Failover happens within 250 ms and you are billed only for the successful completion.
Parameter reference
Shared by /chat/completions and /responses.
| Parameter | Type | Description |
|---|---|---|
| model required | string | Listing ID, e.g. zeph-nexus-4. Use auto with routing rules to let the gateway pick. |
| messages required | array | Conversation turns. System, user, assistant and tool roles supported. |
| temperature optional | number 0–2 | Sampling temperature. Default 0.7. Use 0 for reproducible evals. |
| top_p optional | number 0–1 | Nucleus sampling. Default 0.95. |
| max_tokens optional | integer | Output budget. Hard-capped by the model's context window. |
| stream optional | boolean | Stream via SSE. Default false. |
| tools optional | array | Function definitions. Validated against JSON Schema draft 2020-12. |
| response_format optional | object | {"type":"json_schema", …} for guaranteed parseable output. |
| metadata optional | object | Up to 16 key/value pairs echoed in usage telemetry (max 512 chars each). |
| fallbacks optional | array | Model IDs to retry on failure, in order. |
Errors & limits
Errors return a JSON body with error.code, error.message and error.request_id. Quote the request ID when contacting support.
| HTTP | Code | Meaning | Retry |
|---|---|---|---|
| 400 | invalid_request | Malformed payload or unsupported parameter | No |
| 401 | invalid_api_key | Missing, revoked or wrong-environment key | No |
| 402 | insufficient_credits | Balance or spend cap reached | After top-up |
| 429 | rate_limit_exceeded | Key or model rate limit hit | Yes, with backoff |
| 500 | gateway_error | Upstream vendor failure | Yes |
| 503 | model_unavailable | Listing degraded or maintenance | Yes, or use fallbacks |
| 529 | vendor_overloaded | Vendor at capacity | Yes, with backoff |
Default limits
- Starter 20 req/min · Developer 500 req/min · Scale custom up to 20,000 req/min.
- Concurrent streams: 4 / 64 / custom per key.
- Payload ceiling 32 MB; file uploads 100 MB via
/files.
SDKs
Official clients share the same auth, retries and streaming helpers. Any OpenAI SDK also works — point it at the ZephAI base URL.
pip install zephainpm i zephaigo get github.com/zephai/zephai-gocargo add zephaibase_url="https://api.zephai.dev/v1" and your ZephAI key as the API key. Chat, tools, embeddings and images behave identically.Vendor API
Vendors manage listings and read telemetry through a separate namespace authenticated with an vnd_live_ key. Rate limit: 120 req/min.
/vendor/v1/listingsCreate a listing draft/vendor/v1/listings/{id}/submitSubmit for review/vendor/v1/listings/{id}/healthProbe results & SLO status/vendor/v1/telemetryRequests, latency, revenue/vendor/v1/payoutsStatements & payout status/vendor/v1/webhooksRegister a signed webhookcurl -X POST https://api.zephai.dev/vendor/v1/listings \ -H "Authorization: Bearer $VENDOR_KEY" \ -d '{ "name": "novalab-mix-70b", "endpoint": "https://inference.novalabs.ai/v1", "modalities": ["text-in", "text-out"], "pricing": {"input_per_m": 0.58, "output_per_m": 0.72} }'
Pricing your model
Vendor prices are set per 1M tokens and validated against marketplace guardrails at submission.
- Max markup: 4× your reported inference cost.
- Minimum input price: $0.005 per 1M tokens.
- Benchmarks: must run on ZephEval within 90 days.
- Tiers: Developer and Scale tiers may discount up to 25% below pay-as-you-go.
- Batch: optional 50% discount with a 24-hour execution window.