Claude, GPT and Gemini are temporarily unavailable on AIPower.
Stop hardcoding one model for every request.
Use model="auto" and let AIPower pick, fail over, and log the route.
How it works in 1 line of code:
response = client.chat.completions.create(
model="deepseek/deepseek-chat", # β choose an available Chinese model
messages=[{"role":"user", "content":"Refactor this function..."}],
)No change to request / response shape. The modelfield in the response shows which model actually ran, so you can track cost & quality per route.
Each mode targets a different optimization goal.
General chat / most tasks
model="auto"
Routes to: DeepSeek V3
Goal: Balance of cost & quality
Cost: ~$0.35/M
Default choice when you don't know which to pick
Batch processing, classification
model="auto-cheap"
Routes to: Doubao Pro 256K
Goal: Cost control for routine work
Cost: ~$0.08/M
Classify high-volume messages without hardcoding a premium model
Realtime chat, suggestions, autocomplete
model="auto-fast"
Routes to: Qwen Turbo
Goal: Fastest time-to-first-token
Cost: ~$0.15/M
Live chatbot where latency > quality
Demos, experiments, dev scripts
model="auto-free"
Routes to: GLM-4 Flash
Goal: Utility workload routing
Cost: ~$0.01/M
Prompt engineering experiments and demos
Assume 500 input tokens + 200 output per request (typical chatbot). Here's what you'd pay.
| Strategy | Cost / day | Cost / month |
|---|---|---|
| Only DeepSeek V3 | $310 | $9,300 |
Spend control comes from sending routine tasks to efficient models and reserving premium models for where they matter.
If your primary model returns 5xx, we fall back to a different provider β same request, different upstream. Transparent to your app.
# Illustrative failover chain; not live gateway configuration
FALLBACK = {
deepseek: [qwen-plus],
qwen: [deepseek-chat],
...
}
# Your code stays 1 line:
client.chat.completions.create(
model="deepseek/deepseek-chat",
messages=[...])
# On an upstream error, an available backup may be used.
# Transparent, logged.You could. But you'd have to:
Or use AIPower:
Routing, failover, pricing updates, and analytics are included in the managed gateway instead of becoming another internal DevOps project.
from openai import OpenAI
client = OpenAI(
base_url="https://api.aipower.me/v1",
api_key="sk-your-aipower-key",
)
def smart_ask(task_type: str, messages: list):
"""Route based on task type."""
route_map = {
"chat": "auto", # DeepSeek V3 β balanced
"batch": "auto-cheap", # Doubao Pro β cost-control route
"realtime": "auto-fast", # Qwen Turbo β fastest
"demo": "auto-free", # GLM-4 Flash β utility route
}
return client.chat.completions.create(
model=route_map.get(task_type, "auto"),
messages=messages,
)
# Usage
bulk_classification = smart_ask("batch", [...]) # routine route
live_chat_response = smart_ask("realtime", [...]) # low-latency route
One API key. 10 models. Available routing modes. Usage logs and failover included.
Also: docs / analytics / in-depth blog