Demo Dies ist eine schreibgeschützte Demo. Dokumentation ZephAI kaufen
New

Gateway v2 is live — one endpoint, every model, streaming tool-calls. Read the changelog

Documentation · v2.4

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": { ... } }

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.

Authentication

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.

Headers
Authorization: Bearer zph_live_••••••••••••••••
Content-Type: application/json
X-Zephai-Key-Id: key_9f2a  (optional, for mTLS setups)
Key typePrefixUseRate limit default
Livezph_live_Production traffic500 req/min
Testzph_test_Staging & QA100 req/min
Developmentzph_dev_Local work20 req/min
Vendorvnd_live_Listing & telemetry API120 req/min
Never ship a key in client-side code. Exposed keys in public repositories are auto-revoked by our scanner, usually within 4 minutes.

Endpoints

Base URL: https://api.zephai.dev/v1. Every model — regardless of vendor — answers on the same routes.

POST/chat/completionsChat, vision, tools, streaming
POST/responsesStateful responses API
POST/embeddingsText embeddings & rerank
POST/images/generationsText-to-image
POST/audio/transcriptionsSpeech-to-text
POST/batch24h deferred, 50% price
GET/modelsCatalog with live pricing
GET/usageMetered usage for your keys

Streaming & 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.

text/event-stream
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_capability before 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.

ParameterTypeDescription
model requiredstringListing ID, e.g. zeph-nexus-4. Use auto with routing rules to let the gateway pick.
messages requiredarrayConversation turns. System, user, assistant and tool roles supported.
temperature optionalnumber 0–2Sampling temperature. Default 0.7. Use 0 for reproducible evals.
top_p optionalnumber 0–1Nucleus sampling. Default 0.95.
max_tokens optionalintegerOutput budget. Hard-capped by the model's context window.
stream optionalbooleanStream via SSE. Default false.
tools optionalarrayFunction definitions. Validated against JSON Schema draft 2020-12.
response_format optionalobject{"type":"json_schema", …} for guaranteed parseable output.
metadata optionalobjectUp to 16 key/value pairs echoed in usage telemetry (max 512 chars each).
fallbacks optionalarrayModel 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.

HTTPCodeMeaningRetry
400invalid_requestMalformed payload or unsupported parameterNo
401invalid_api_keyMissing, revoked or wrong-environment keyNo
402insufficient_creditsBalance or spend cap reachedAfter top-up
429rate_limit_exceededKey or model rate limit hitYes, with backoff
500gateway_errorUpstream vendor failureYes
503model_unavailableListing degraded or maintenanceYes, or use fallbacks
529vendor_overloadedVendor at capacityYes, 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.

Pythonv2.4.0
pip install zephai
Node / TypeScriptv2.4.0
npm i zephai
Gov1.9.2
go get github.com/zephai/zephai-go
Rustbeta
cargo add zephai
OpenAI-compatible: set base_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.

POST/vendor/v1/listingsCreate a listing draft
POST/vendor/v1/listings/{id}/submitSubmit for review
GET/vendor/v1/listings/{id}/healthProbe results & SLO status
GET/vendor/v1/telemetryRequests, latency, revenue
GET/vendor/v1/payoutsStatements & payout status
POST/vendor/v1/webhooksRegister a signed webhook
register a listing
curl -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.
The 20% platform fee is already included in the displayed price — subscribers never pay a surcharge, and you keep 80% of net revenue with net-15 payouts.