API Reference
JoyToken currently exposes an OpenAI-compatible model gateway for developers. Applications can keep using OpenAI SDKs, LangChain, Cursor, Claude Code, Codex CLI, and other OpenAI-compatible tools. JoyToken adds API key validation, policy constraints, model routing, wallet freeze, and usage recording at the gateway layer.
This page only describes public interfaces that are present in the current project. Console, API key management, policy configuration, billing management, and similar backend APIs are currently used by JoyToken Console and are not documented as stable developer APIs.
Base URLs
Authentication
Model calls require a JoyToken API key. Use the Authorization header because it matches OpenAI SDKs and common AI tool configuration.
The gateway currently also accepts X-API-Key, mainly for legacy clients and hand-written HTTP calls.
If both headers are present, the current gateway reads X-API-Key first. When migrating to Bearer authentication, do not keep the old X-API-Key on the same request.
Current Public Endpoints
Request Headers
Response Headers
Response Metadata
For non-streaming successful calls, the gateway merges JoyToken metadata into the OpenAI-compatible JSON metadata field when possible. For streaming calls, it appends a metadata SSE record before [DONE].
Common fields:
Error Shape
Model call errors use an OpenAI-compatible structure:
When debugging, record X-Request-ID, request model / tier, HTTP status, error.type, and on successful responses the X-DAOE-Used-Model and X-DAOE-Used-Provider headers.