Integration tutorial
OpenAI Node SDK
Use the official JavaScript client with one compatible endpoint.
01
Buy or create a key
Use guest checkout or create an account key.
02
Set the base URL
https://discountedtokens.com/v1
03
Send a small test
Verify the route before moving production traffic.
app.mjs
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.DISCOUNTEDTOKENS_API_KEY,
baseURL: "https://discountedtokens.com/v1",
});
const response = await client.chat.completions.create({
model: "gpt-5.6",
messages: [{ role: "user", content: "Reply OK" }],
});
console.log(response.choices[0].message.content);
Run and verify
npm install openai
export DISCOUNTEDTOKENS_API_KEY="YOUR_DISCOUNTEDTOKENS_KEY"
node app.mjs
Troubleshooting
- Do not commit .env files or API keys.
- Use baseURL with a capital URL in the JavaScript SDK.
- Log request identifiers, not prompts or full keys.
Configuration source: official documentation. DiscountedTokens is an independent gateway and is not endorsed by the client vendor.