Migrating from OpenAI
Appelon’s API is fully OpenAI-compatible. Your existing code, SDKs, and tools work without modification. Just change the base URL.
The one-line change
Add base_url to your OpenAI client initialization.
Python
# Before (OpenAI)
client = OpenAI(
api_key="sk-openai-key"
)
# After (Appelon)
client = OpenAI(
api_key="sk-appelon-key",
base_url="https://router.appelon.ai/v1" # ← add this
)
Node.js
// Before (OpenAI)
const client = new OpenAI({
apiKey: 'sk-openai-key',
});
// After (Appelon)
const client = new OpenAI({
apiKey: 'sk-appelon-key',
baseURL: 'https://router.appelon.ai/v1', // ← add this
});
Model mapping
Update model names to use Appelon’s models.
| OpenAI model | Appelon model | Use for |
|---|---|---|
| gpt-4o | qwen |
General chat, fast |
| gpt-4-turbo | gemma |
Complex reasoning |
| text-embedding-3-small | bge-m3 |
Embeddings, search |
| dall-e-3 | flux-schnell |
Image generation |
| whisper-1 | whisperx |
Speech to text |
Environment variables
Set environment variables to avoid code changes entirely.
# Add to .env or shell profile
export OPENAI_API_KEY="sk-appelon-key"
export OPENAI_BASE_URL="https://router.appelon.ai/v1"
With these variables set, code that uses OpenAI() without arguments will automatically use Appelon.
What works
- Chat completions: streaming, system prompts, multi-turn
- Embeddings: single and batch
- Image generation: FLUX models via /v1/images/generations
- Transcription: WhisperX with speaker diarization
- Models endpoint: /v1/models lists available models
Not yet supported
These OpenAI features are not available yet:
- Function calling / tool use
- Vision (image input)
- Assistants API
- Fine-tuning
Using with LangChain
LangChain’s OpenAI integration works out of the box.
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="qwen",
openai_api_key="sk-appelon-key",
openai_api_base="https://router.appelon.ai/v1"
)
Need help migrating? Contact us at support@appelon.ai and we’ll help you switch.