General Questions

AppleRouter is a unified AI API gateway that provides access to multiple AI model providers (OpenAI, Anthropic Claude, Google Gemini, etc.) through a single API interface. You only need one API key to access all supported models.
AppleRouter supports models from:
  • OpenAI: GPT-4o, GPT-4 Turbo, GPT-3.5, DALL-E 3, Whisper, TTS, Sora
  • Anthropic: Claude Opus 4.5, Claude Sonnet 4, Claude 3.5 Sonnet, Claude 3 Haiku
  • Google: Gemini 2.0 Flash, Gemini 1.5 Pro, Imagen, Veo
  • Others: Kling, Jimeng, and more
See the Models page for the complete list.
Yes! AppleRouter is fully compatible with the OpenAI API format. Just change the base_url to https://api.applerouter.ai/v1 and use your AppleRouter API key.
from openai import OpenAI
client = OpenAI(
    api_key="YOUR_APPLEROUTER_KEY",
    base_url="https://api.applerouter.ai/v1"
)
Yes, AppleRouter auto-detects the API format based on request headers:
HeadersDetected Format
x-api-key + anthropic-versionAnthropic Claude
x-goog-api-key or key query paramGoogle Gemini
DefaultOpenAI
AppleRouter uses pay-as-you-go pricing based on token usage. Visit the Console to view current pricing for each model.

Error Handling

Cause: The API key is missing, invalid, or expired.Solutions:
  1. Verify your API key is correct
  2. Check the key hasn’t been deleted in the Console
  3. Ensure the Authorization header format is correct: Bearer YOUR_API_KEY
# Correct format
curl https://api.applerouter.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-xxx..."
Cause: Too many requests in a short period.Solutions:
  1. Implement exponential backoff retry logic
  2. Reduce request frequency
  3. Contact support for higher rate limits
import time
from openai import RateLimitError

def call_with_retry(func, max_retries=5):
    for i in range(max_retries):
        try:
            return func()
        except RateLimitError:
            time.sleep(2 ** i)
    raise Exception("Max retries exceeded")
Cause: Request parameters are incorrect or missing.Common issues:
  • Missing required fields (e.g., model, messages)
  • Invalid model name
  • Incorrect message format
  • Unsupported parameters for the selected model
Solution: Check your request against the API Reference.
Cause: Temporary server or upstream provider issue.Solutions:
  1. Retry after a short delay
  2. If persistent, check status page for outages
  3. Consider implementing model fallback
models = ["gpt-4o", "claude-sonnet-4-20250514", "gemini-2.0-flash"]
for model in models:
    try:
        response = client.chat.completions.create(model=model, messages=messages)
        break
    except Exception:
        continue
Cause: Request took too long to complete.Solutions:
  1. Reduce max_tokens to get shorter responses
  2. Set appropriate timeout values in your client
  3. Use streaming for long responses
  4. For video generation, use async polling instead of waiting
client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.applerouter.ai/v1",
    timeout=120.0  # 2 minutes
)

Usage Tips

  1. Be concise: Write clear, focused prompts
  2. Limit history: Only include relevant conversation context
  3. Use system prompts: Set expectations upfront to reduce back-and-forth
  4. Set max_tokens: Limit response length when appropriate
  5. Choose the right model: Use smaller models (GPT-3.5, Haiku) for simple tasks
Use CaseRecommended Models
Complex reasoningGPT-4o, Claude Opus 4.5, Gemini 1.5 Pro
Fast responsesGPT-4o-mini, Claude 3 Haiku, Gemini 2.0 Flash
Code generationClaude Sonnet 4, GPT-4o
Creative writingClaude Opus 4.5, GPT-4o
Cost-sensitiveGPT-3.5 Turbo, Claude 3 Haiku
Image generationDALL-E 3, Gemini Imagen
Video generationSora, Kling, Veo
Streaming improves perceived latency by showing responses as they’re generated.
stream = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True
)

for chunk in stream:
    content = chunk.choices[0].delta.content
    if content:
        print(content, end="", flush=True)
Some features like response_format (JSON mode) may not work with streaming on all models.
  1. Summarize history: Periodically summarize older messages
  2. Sliding window: Keep only the last N messages
  3. Selective context: Only include messages relevant to the current topic
def trim_messages(messages, max_messages=10):
    system = [m for m in messages if m["role"] == "system"]
    others = [m for m in messages if m["role"] != "system"]
    return system + others[-max_messages:]

Account & Billing

Log in to the AppleRouter Console to view:
  • Current balance
  • Usage history by model
  • API request logs
Visit the billing section in the Console to add credits to your account.
API requests will return a 402 Payment Required error. Add funds to continue using the service.

Still Need Help?