Troubleshooting

First confirm whether the request reached JoyToken. Then determine whether the issue is authentication, policy, wallet, routing, upstream, or client parsing.

SDK Installation

SymptomCheck
npm returns 404 Not Found for @joytoken/*The TypeScript packages are distributed from GitHub, not the npm registry. Use the GitHub #path:/client-sdk-ts or #path:/agent-sdk-ts dependency shown in the SDK quickstart.
Agent SDK reports a missing peer dependencyDeclare both @joytoken/agent-sdk-ts and @joytoken/client-sdk-ts as direct GitHub dependencies.
Go cannot resolve the old moduleUse github.com/jd-opensource/joytoken-sdk-go; remove github.com/joytoken/client-sdk-golang imports.
A Git dependency changes unexpectedlyPin a release tag or commit instead of following the default branch.

Quick Check

CheckExpected value
Base URLJOY_TOKEN_OPENAI_BASE_URL from Environments
Chat endpointPOST /openai/v1/chat/completions
Responses endpointPOST /openai/v1/responses (plural)
AuthAuthorization: Bearer $JOY_TOKEN_API_KEY
Content-Typeapplication/json
ModelTest with auto first
Request bodyChat Completions uses non-empty messages; Responses uses input
Request IDSend X-Request-ID
WalletTarget tier has balance
PolicyIP, tier, and model are allowed

Status Codes

StatusCommon causeFix
400Bad JSON, missing input or messages, oversized bodyFix request
401No API keyCheck auth header
402Wallet or budget insufficientTop up, lower tier, adjust budget
403Key, IP, tier, or model policy rejectedCheck API key policy
405Wrong methodUse POST for the selected protocol endpoint
502Routing or upstream failureShort backoff retry, record request ID
503 / 504Service unavailable or timed outExponential backoff retry

Minimal Reproduction

Responses API:

curl "$JOY_TOKEN_OPENAI_BASE_URL/responses" \
-H "Authorization: Bearer $JOY_TOKEN_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Request-ID: debug-minimal-responses-001" \
-d '{
"model": "auto",
"input": "ping",
"stream": false
}'

Chat Completions:

curl "$JOY_TOKEN_OPENAI_BASE_URL/chat/completions" \
-H "Authorization: Bearer $JOY_TOKEN_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Request-ID: debug-minimal-openai-001" \
-d '{
"model": "auto",
"messages": [{ "role": "user", "content": "ping" }],
"stream": false
}'

Debugging Order

  1. Search JoyToken Console logs by X-Request-ID.
  2. Confirm the API key is active.
  3. Check IP, tier, and model blacklist.
  4. Check wallet balance and key budget.
  5. Inspect metadata.model and billing metadata on successful responses.
  6. Confirm usage is attributed to the same API key.

Common Questions

QuestionCheck first
Responses returns 404 page not foundUse the plural path /openai/v1/responses, not /openai/v1/response
Works from one source, 403 from anotherSource IP or key policy
Concrete model ID is rejectedRequests accept only auto; catalog IDs are informational
auto failsno candidate models after tier, policy, wallet, and budget filters
Streaming frontend hangsSSE parsing handles metadata and [DONE]
Responses stream does not finishRead response.output_text.delta and stop after response.completed
Usage is missingRequest succeeded and used the same key