Migrate from OpenAI
Migrating from the OpenAI API to TokenSupernova requires exactly two changes in your code.
Step 1: Change the Base URL
Section titled “Step 1: Change the Base URL”base_url="https://api.openai.com/v1"base_url="https://api.tokensupernova.com/v1"Step 2: Change the API Key
Section titled “Step 2: Change the API Key”api_key="sk-proj-xxxxxxxxxxxxx"api_key="tsn_live_xxxxxxxxxxxxx"That’s It
Section titled “That’s It”Your existing code continues to work. All standard OpenAI parameters (temperature, max_tokens, stream, etc.) are supported.
Language-Specific Examples
Section titled “Language-Specific Examples”:::tab Python
# Before (OpenAI)from openai import OpenAIclient = OpenAI( api_key="sk-proj-xxx",)
# After (TokenSupernova)from openai import OpenAIclient = 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",});::: :::
Model Mapping
Section titled “Model Mapping”| OpenAI Model | TokenSupernova Equivalent | Notes |
|---|---|---|
gpt-4o | deepseek-chat | Strong general performance |
gpt-4o-mini | qwen-plus | Budget-friendly, fast |
o1 / o3 | deepseek-reasoner | Reasoning tasks |
Environment Variable Setup
Section titled “Environment Variable Setup”Store credentials in environment variables for easy switching:
OPENAI_API_KEY=tsn_live_xxxOPENAI_BASE_URL=https://api.tokensupernova.com/v1Then use the default client:
from openai import OpenAIclient = OpenAI() # Reads OPENAI_API_KEY and OPENAI_BASE_URL from envThings to Know
Section titled “Things to Know”- 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