Skip to content

Migrate from OpenAI

Migrating from the OpenAI API to TokenSupernova requires exactly two changes in your code.

base_url="https://api.openai.com/v1"
base_url="https://api.tokensupernova.com/v1"
api_key="sk-proj-xxxxxxxxxxxxx"
api_key="tsn_live_xxxxxxxxxxxxx"

Your existing code continues to work. All standard OpenAI parameters (temperature, max_tokens, stream, etc.) are supported.

:::tab Python

# Before (OpenAI)
from openai import OpenAI
client = OpenAI(
api_key="sk-proj-xxx",
)
# After (TokenSupernova)
from openai import OpenAI
client = OpenAI(
api_key="tsn_live_xxx",
base_url="https://api.tokensupernova.com/v1",
)

:::tab Node.js

// Before (OpenAI)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-proj-xxx",
});
// After (TokenSupernova)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "tsn_live_xxx",
baseURL: "https://api.tokensupernova.com/v1",
});

::: :::

OpenAI ModelTokenSupernova EquivalentNotes
gpt-4odeepseek-chatStrong general performance
gpt-4o-miniqwen-plusBudget-friendly, fast
o1 / o3deepseek-reasonerReasoning tasks

Store credentials in environment variables for easy switching:

.env
OPENAI_API_KEY=tsn_live_xxx
OPENAI_BASE_URL=https://api.tokensupernova.com/v1

Then use the default client:

from openai import OpenAI
client = OpenAI() # Reads OPENAI_API_KEY and OPENAI_BASE_URL from env
  • Function calling: Supported on DeepSeek V3 and Qwen-Max
  • Vision: Currently not available (coming soon)
  • TTS / STT: Not supported
  • Embeddings: Supported on select models
  • Fine-tuning: Not available