OpenAI SDK base URL

Point your OpenAI SDK at the TKEN gateway

If your app already uses the OpenAI JavaScript or Python SDK, keep the client shape and set the base URL to https://www.tken.shop/v1 for TKEN model routing.

Node.js openai package
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.TKEN_API_KEY,
  baseURL: "https://www.tken.shop/v1"
});

const response = await client.chat.completions.create({
  model: "MiniMax-M2.7",
  messages: [{ role: "user", content: "Say hello in one sentence." }]
});

console.log(response.choices[0].message.content);
Change base URL, not your app architecture
Use server-side environment variables
Validate model names before production

Python example

Keep a small smoke test in your repo so a model or route change is caught before it reaches production traffic.

Python base_url
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TKEN_API_KEY"],
    base_url="https://www.tken.shop/v1",
)

result = client.chat.completions.create(
    model="MiniMax-M2.7",
    messages=[{"role": "user", "content": "Write one test prompt."}],
)

print(result.choices[0].message.content)

Migration checklist

1. Move secrets to environment variables

Use TKEN_API_KEY on the server. Do not ship API keys in browser bundles, mobile apps or public demo repositories.

2. Set the base URL

Configure the OpenAI-compatible client base URL as https://www.tken.shop/v1. Keep a small request timeout and log non-sensitive error codes during testing.

3. Verify model and pricing

Use the live pricing page for current model availability and cost. Do not hard-code public price claims in your own marketing or docs unless you update them whenever pricing changes.

Disclosure: TKEN is an independent third-party API gateway, not an official endpoint for OpenAI or other model providers.

Run a one-request smoke test

Start with a single chat completion, confirm the model response, then move the same base URL into your app configuration.