Chat Completions
Creates a model response for a chat conversation. This endpoint accepts OpenAI-compatible chat payloads and adds JoyToken routing, policy, wallet, and usage metadata around the provider call.
身份验证
AuthorizationBearer
Use Authorization: Bearer $JOY_TOKEN_API_KEY.
请求头
X-API-Key
Compatibility API key header. Prefer Authorization Bearer for new integrations.
请求
This endpoint expects an object.
messages
OpenAI-compatible chat messages.
model
Model ID. Use auto or omit to let JoyToken route automatically.
tier
JoyToken model tier.
stream
Return an OpenAI-compatible SSE stream when true.
temperature
Sampling temperature forwarded to the selected provider when supported.
top_p
Nucleus sampling value forwarded to the selected provider when supported.
max_tokens
Maximum output tokens. Also participates in JoyToken billing estimation.
user
Optional end-user identifier used as route session context.
tools
OpenAI-compatible tool definitions.
响应头
X-DAOE-Used-Model
The final model selected by JoyToken routing.
X-DAOE-Used-Provider
The provider that served the request.
X-DAOE-Failover
Present on streaming responses when provider failover occurred.
响应
Successful chat completion response.
id
object
choices
created
model
usage
metadata
JoyToken routing and billing metadata appended by the gateway when available.
错误
400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
429
Too Many Requests Error
500
Internal Server Error