Quickstart

Choose the protocol used by your application. You only need the Base URL for that protocol.

Required Values

ItemValue
API keyJOY_TOKEN_API_KEY=sk-xxx
Modelauto (not configurable)

Choose a Protocol

Base URL: https://api.joytokens.ai/openai/v1

export JOY_TOKEN_API_KEY="sk-xxx"
export JOY_TOKEN_OPENAI_BASE_URL="https://api.joytokens.ai/openai/v1"

Responses API with cURL

curl -sS -X POST "$JOY_TOKEN_OPENAI_BASE_URL/responses" \
-H "Authorization: Bearer $JOY_TOKEN_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Request-ID: quickstart-responses-001" \
-d '{
"model": "auto",
"input": "Reply with exactly: pong",
"max_output_tokens": 1024,
"stream": false
}'

Responses API with the OpenAI SDK

import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.JOY_TOKEN_API_KEY,
baseURL: process.env.JOY_TOKEN_OPENAI_BASE_URL,
});
const response = await client.responses.create({
model: "auto",
input: "Reply with exactly: pong",
max_output_tokens: 1024,
});
console.log(response.output_text);

Chat Completions with cURL

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

Chat Completions with the OpenAI SDK

import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.JOY_TOKEN_API_KEY,
baseURL: process.env.JOY_TOKEN_OPENAI_BASE_URL,
});
const response = await client.chat.completions.create({
model: "auto",
messages: [{ role: "user", content: "Reply with exactly: pong" }],
max_tokens: 1024,
});
console.log(response.choices[0]?.message?.content);

Check the Integration

PlaceExpected result
Program outputResponse contains pong
Response metadatametadata.model and metadata.billing
JoyToken ConsoleLogs and usage are attributed to this API key

Keep API keys in server-side environment variables, secret managers, or CI/CD secrets. Do not put them in browsers, mobile apps, public repositories, or logs.