API Guide

JoyToken currently exposes an OpenAI-compatible model gateway for developers. Point your OpenAI SDK or HTTP client base URL at JoyToken to integrate.

Public Endpoints

EndpointAuthUse
POST /openai/v1/chat/completionsAPI key requiredChat completions with non-streaming and SSE streaming support
GET /api/v1/modelsNo API key requiredPublic model catalog

Base URLs

ScenarioBase URL
OpenAI-compatible model callsJOY_TOKEN_OPENAI_BASE_URL from Environments
JoyToken APIJOY_TOKEN_API_BASE_URL from Environments

Authentication

Authorization: Bearer $JOY_TOKEN_API_KEY

For compatibility with older clients:

X-API-Key: $JOY_TOKEN_API_KEY

Do not send both Authorization and X-API-Key on the same request. If both are present, the current gateway reads X-API-Key first.

Minimal Request

$curl "$JOY_TOKEN_OPENAI_BASE_URL/chat/completions" \
> -H "Content-Type: application/json" \
> -H "Authorization: Bearer $JOY_TOKEN_API_KEY" \
> -H "X-Request-ID: quickstart-001" \
> -d '{
> "model": "auto",
> "messages": [
> { "role": "user", "content": "Reply with exactly: pong" }
> ],
> "stream": false
> }'

Response Fields to Check

FieldLocationUse
choices[0].message.contentBodyModel output
usageBodyToken and cost statistics
metadata.billingBody / streaming metadataJoyToken billing details
X-DAOE-Used-ModelResponse headerActual selected model
X-DAOE-Used-ProviderResponse headerActual provider
X-Request-IDRequest headerLog and debugging correlation