❱ API Reference
Base URL:
https://inference-api-611798501438.us-central1.run.appThe Majestix AI Inference Hub API is a multi-model AI gateway that provides unified access to models from OpenAI, Anthropic, Google Vertex AI, and OpenRouter through a single credits-based billing system.
Authentication
All endpoints require authentication via one of two methods:
API Key
X-Api-Key: inf_...
VSCode extension, CLI tools, programmatic access
Firebase Auth + App Check
Authorization: Bearer <id_token> and X-Firebase-AppCheck: <token>
Browser-based web applications
API keys are issued through the /api-keys endpoint and use the inf_ prefix. Firebase authentication is handled through the web SDK and is intended exclusively for browser clients.
Streaming Protocol (SSE)
Streaming endpoints (/chat, /code) return Server-Sent Events (SSE) with the following event types:
chunk
Incremental text content: {"type": "chunk", "content": "..."}
tool_use
Tool call from the model: {"type": "tool_use", "id": "...", "name": "...", "input": {...}}
done
Stream complete: {"type": "done", "model": "...", "session_id": "...", "credits_used": 42}
error
Error during generation: {"type": "error", "message": "..."}
Each SSE message is formatted as:
Endpoints
Credits
All API usage is billed in credits. 1 credit equals $0.001 USD. A 1.4x margin is applied to raw provider costs. Credits are reserved at the worst-case estimate before generation begins and reconciled to the actual amount when the response completes.
Free
$0
500
Guru
$10/mo
10,000
Pro
$50/mo
55,000
Additional credits can be purchased as one-time top-ups through the /billing/topup endpoint.
Error Responses
All endpoints return errors in a consistent JSON format:
400
Bad request (invalid parameters)
401
Authentication failed or missing
403
Forbidden (insufficient permissions or credits)
404
Resource not found
429
Rate limit exceeded
500
Internal server error
Last updated
