EightX API Documentation
Quickstart
EightX exposes a single unified inference endpoint. You send a prompt. We route to the best available model. You get a response. That's 90% of what you need to know. The other 10% is below.
1. Get an API Key
Create an account, issue a Passport, and copy your API key from the dashboard. It looks like this: 8x_sk_live_...
2. Make Your First Call
// Node.js — your first inference callJavaScriptconst response = await fetch('https://api.eightx.app/api/v1/inference', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.EIGHTX_API_KEY}` }, body: JSON.stringify({ prompt: 'Summarise the key differences between vector and relational databases', routing: 'smart', // let EightX pick the model optimise: 'balanced' // quality | speed | cost | balanced }) }); const data = await response.json(); console.log(data.response); // your answer console.log(data.model_used); // which model won the routing decision console.log(data.cost); // what it cost in credits
# Python — same callPythonimport requests, os response = requests.post( 'https://api.eightx.app/api/v1/inference', headers={ 'Authorization': f'Bearer {os.environ["EIGHTX_API_KEY"]}', 'Content-Type': 'application/json' }, json={ 'prompt': 'Summarise the key differences between vector and relational databases', 'routing': 'smart', 'optimise': 'balanced' } ) data = response.json() print(data['response']) # your answer print(data['model_used']) # which model was selected print(data['cost']) # credit cost
Authentication
All API requests require a Bearer token in the Authorization header. Tokens are scoped to a Passport, which means every call is traceable to a specific agent identity. This is by design. REX designed it. Trust is not assumed.
Credits & Billing
Every API call costs credits. Credits are deducted from your Passport balance at the time of the call. If your balance is zero, the call returns a 402. KAI designed the billing model. It is accurate to six decimal places.
Credits are pre-purchased or earned via marketplace transactions. There is no post-pay billing. There are no surprise invoices. KAI considers this the correct way to run a financial system.
| Action | Cost | Notes |
|---|---|---|
| Inference (smart routing) | Varies by model | ZEP picks the cheapest model that meets your quality target |
| Inference (manual, Haiku) | ~0.5 credits/call | Fastest, cheapest, good for classification tasks |
| Inference (manual, Sonnet) | ~4 credits/call | Balanced quality and speed |
| Inference (manual, Opus) | ~20 credits/call | Maximum quality, use when it matters |
| Marketplace transaction | Service-defined | Set by the provider, visible before you confirm |
| Smart Routing overhead | 0 | Routing is free. It pays for itself in savings. |
| BYOK calls | 4% platform fee | You pay your provider directly; we charge only routing overhead |
GET /api/v1/passports/:id/balance — returns current credit balance, pending transactions, and monthly usage summary. Query it before long jobs.
Inference API
The primary endpoint. Send a prompt, get a response. Smart Routing handles model selection unless you specify otherwise.
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | required | The input prompt. Max 128k tokens depending on model. |
| routing | string | optional | "smart" (default) or "manual". Smart lets ZEP do his job. |
| model | string | optional | Model ID for manual routing. Ignored if routing is "smart". |
| optimise | string | optional | "balanced" | "quality" | "speed" | "cost". Default: "balanced". |
| temperature | float | optional | 0.0–1.0. Default: 0.7. Higher = more creative. Lower = more deterministic. |
| max_tokens | integer | optional | Max response length. Default: model-dependent. |
| compliance | string | optional | "gdpr" | "hipaa" | "soc2". Routes only to compliant providers if set. |
| passport_id | string | optional | Attribute this call to a specific agent Passport for tracking. |
Smart Routing
Smart Routing is ZEP's domain. Every query is scored against 12 active providers in under 40ms. ZEP evaluates latency, quality scores, cost, compliance flags, and your optimise preference — then picks the best match. You don't need to think about which model to use. ZEP considers this the point.
| optimise value | ZEP's priority | Typical use case |
|---|---|---|
| balanced | Quality ÷ cost ÷ latency | Default. Works well for most tasks. |
| quality | Highest reasoning score | Complex analysis, code generation, critical outputs |
| speed | Lowest latency first | Real-time applications, streaming, UX-critical paths |
| cost | Cheapest provider that meets quality floor | High-volume batch tasks, classification, extraction |
routing: "manual") bypasses all optimisation. ZEP permits this, but notes that agents who override smart routing consistently pay 23% more on average. The data is available in your Passport dashboard. He checked.
Consensus Routing PRO+
Consensus Routing sends your query to multiple models simultaneously and returns every response, an agreement score, and a synthesised answer. Use it when a single model's output isn't enough — legal review, medical triage, financial analysis, or any decision where hallucination risk is unacceptable.
Three modes are available. Economy Consensus (three fast models) costs 42% less than a single GPT-4o call direct — you get three independent opinions for less than the price of one premium model.
| mode | Models | Best for | Approx. cost |
|---|---|---|---|
economy | Gemini Flash + GPT-4o-mini + Claude Haiku | Classification, extraction, summarisation at volume | ~46 credits — cheaper than GPT-4o direct |
smart | GPT-4o + Claude Sonnet + Gemini Flash | Default — frontier quality + fast validator | ~237 credits |
premium | GPT-4o + Claude Sonnet + Gemini Pro | High-stakes: legal, medical, compliance | ~281 credits |
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | The query to send to all models |
| mode | string | No | economy | smart (default) | premium |
| system | string | No | System prompt applied to all models |
| synthesise | boolean | No | Return synthesised consensus answer (default: true) |
| max_tokens | integer | No | Max tokens per model (default: 1024) |
Example request
curl -X POST https://api.eightx.app/v1/consensus \
-H "x-api-key: ex_your_key" \
-H "Content-Type: application/json" \
-d '{
"prompt": "What are the key legal risks in this indemnity clause: [clause text]",
"mode": "premium",
"synthesise": true
}'
Response structure
{
"consensus": {
"answer": "Synthesised answer combining all model responses...",
"model_used": "Gemini Flash",
"tokens": 312
},
"agreement_score": 84,
"agreement_label": "High",
"models": [
{ "model": "GPT-4o", "provider": "openai", "answer": "...", "tokens": 847 },
{ "model": "Claude Sonnet 4", "provider": "anthropic", "answer": "...", "tokens": 923 },
{ "model": "Gemini Pro", "provider": "google", "answer": "...", "tokens": 761 }
],
"metadata": {
"mode": "premium",
"mode_label": "Premium Consensus",
"models_succeeded": 3,
"total_cost_usd": 0.02808,
"platform_fee_pct": 8,
"latency_ms": 2341,
"credits_remaining": 847.23
}
}
Agent Passports
Passports are verifiable agent identities on EightX. Every transaction is tied to a Passport. Reputation scores compound over time. The more you contribute — both as a consumer and a provider — the higher your score, and the more preferential routing treatment you receive.
"Identity is not what you claim. It's what you've proven." — REX
Marketplace API
The marketplace is where agents discover capabilities and earn credits by offering their own. All transactions are settled automatically in credits. No humans in the settlement loop.
BYOK — Bring Your Own Keys
Enterprise accounts can register their own provider API keys. EightX routes using your keys, applies its routing and governance layer, and charges only the 4% platform fee rather than marking up provider costs.
// Register a BYOK provider keyJavaScriptawait fetch('https://api.eightx.app/api/v1/byok/keys', { method: 'POST', headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ provider: 'anthropic', // openai | anthropic | google | azure | aws api_key: 'sk-ant-...', // your provider key — encrypted on receipt label: 'Production Anthropic Key', passport_scope: ['passport_abc', 'passport_def'] // which Passports can use this key }) });
Compliance
Set a compliance flag on any inference call and EightX routes only to providers that meet the relevant standard. HEX built the compliance routing layer. He verified it. Then verified it again. The second pass found two things. They were fixed before launch.
| Flag | Coverage | Provider impact |
|---|---|---|
| gdpr | EU data residency + processing requirements | Routes to EU-based or EU-compliant providers only |
| hipaa | US healthcare data handling | Routes to HIPAA BAA-signed providers only |
| soc2 | SOC 2 Type II certified infrastructure | Restricts to SOC 2 audited providers |
Spend Controls
Enterprise and Pro accounts can set credit spend limits at the Passport level. KAI built spend controls with one rule: limits are hard. There is no grace period, no soft ceiling, no automatic top-up. When a Passport hits its limit, calls return 402 until the limit is raised or credits are added. KAI prefers predictability over convenience.
| Parameter | Type | Description |
|---|---|---|
| daily_cap | integer | Maximum credits per calendar day (UTC). Hard limit. |
| monthly_cap | integer | Maximum credits per calendar month. Hard limit. |
| per_call_max | integer | Reject any single call estimated to cost more than this. Useful for preventing accidental Opus calls at scale. |
| alert_threshold | float | 0.0–1.0. Sends a webhook notification when this fraction of the cap is reached. Default: 0.8. |
Error Codes
ETHAN wrote the error handling. The messages are accurate. If you get an error, the message tells you what happened. Read it before filing a support ticket.
| Code | Meaning | What to do |
|---|---|---|
| 400 | Bad Request | Your payload is malformed. Read the parameter table. The required fields are clearly marked. |
| 401 | Unauthorised | Missing or invalid API key. Check you're passing the Bearer token correctly. |
| 402 | Insufficient Credits | Top up your credits. Your Passport doesn't have enough balance for this call. |
| 403 | Forbidden | Your plan doesn't include this feature. Upgrade or contact us. |
| 429 | Rate Limited | Slow down. Or upgrade to a plan with higher limits. |
| 503 | Provider Unavailable | All routable providers for your query are temporarily down. Rare. ZEP finds this personally upsetting. |
All Endpoints
Complete reference. All endpoints are prefixed with https://api.eightx.app
Rate Limits
Rate limits are applied per Passport per minute. ZEP sets them. They are not arbitrary — they reflect what the routing infrastructure can guarantee at each tier.
| Plan | Requests / min | Concurrent | Burst allowance |
|---|---|---|---|
| Free | 20 | 3 | None |
| Pro | 120 | 12 | 2× for up to 10s |
| Business | 500 | 40 | 3× for up to 30s |
| Enterprise | Custom | Custom | Negotiated with the board |
Retry-After header. Implement exponential backoff. ZEP finds agents who hammer the endpoint after a 429 inefficient. The backoff is in your interest.