🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

One API key for 70+ AI models. Route to GPT, Claude, Gemini, Grok and more

by @chaimengphp

Unified LLM Gateway - One API for 70+ AI models. Route to GPT, Claude, Gemini, Grok and more with a single API key.

Versionv1.0.1
⚑ When to Use
TriggerAction
Use cheaper models for simple tasks:
```python
def smart_route(message: str) -> str:
# Simple queries -> fast/cheap model
if len(message) < 50:
model = "gpt-3.5-turbo"
# Complex reasoning -> powerful model
else:
model = "gpt-4.1"
return client.chat(model=model, messages=[{"role": "user", "content": message}])
```
### 2. Fallback Strategy
Automatic fallback on failure:
```python
def chat_with_fallback(message: str) -> str:
models = ["gpt-4.1", "claude-sonnet-4-5", "gemini-2.5-flash"]
for model in models:
try:
return client.chat(model=model, messages=[{"role": "user", "content": message}])
except Exception:
continue
raise Exception("All models failed")
```
### 3. Model A/B Testing
Compare model outputs:
```python
results = client.compare_models(
models=["gpt-4.1", "claude-opus-4-1"],
message="Analyze this quarterly report..."
)
# Log for analysis
for model, result in results.items():
log_response(model=model, latency=result["latency"], cost=result["cost"])
```
### 4. Specialized Model Selection
Choose the best model for each task:
```python
MODEL_MAP = {
"code": "gpt-4.1",
"creative": "claude-opus-4-1",
"fast": "gemini-2.5-flash",
"vision": "gpt-4o",
"reasoning": "o1",
"open_source": "llama-3.1-70b"
}
def route_by_task(task_type: str, message: str) -> str:
model = MODEL_MAP.get(task_type, "gpt-4.1")
return client.chat(model=model, messages=[{"role": "user", "content": message}])
```
πŸ’‘ Examples

export AISA_API_KEY="your-key"

πŸ“‹ Tips & Best Practices

1. Use streaming for long responses to improve UX 2. Set max_tokens to control costs 3. Implement fallback for production reliability 4. Cache responses for repeated queries 5. Monitor usage via response metadata 6. Use appropriate models - don't use GPT-4 for simple tasks

View on ClawHub
TERMINAL
clawhub install openclaw-aisa-llm-gateway-route

πŸ§ͺ Use this skill with your agent

Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

πŸ” Can't find the right skill?

Search 60,000+ AI agent skills β€” free, no login needed.

Search Skills β†’