SweetRouterAPI

Get started

Quick start

Get your first chat reply in about five minutes.

1. Create an account

Sign up with your email. New accounts get a small welcome balance for testing.

2. Add balance

When you need more, top up on the Billing page. You only pay for what you use. See Pricing.

3. Create an API key

On the API keys page, click Create key and copy it. It starts with sr_live_ and is shown once. Keep it on your server, never in a website or app.

shell
# macOS / Linux
export SWEETROUTER_API_KEY="sr_live_..."

# Windows PowerShell
$env:SWEETROUTER_API_KEY = "sr_live_..."

4. Send your first message

Run this in a terminal:

curl
curl https://api.sweetrouter.com/v1/chat/completions \
  -H "Authorization: Bearer $SWEETROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "sweet-character-1", "messages": [{"role": "user", "content": "Hello!"}]}'

Or use the OpenAI SDK: set the base URL to https://api.sweetrouter.com/v1 and the model to sweet-character-1.

python
# pip install openai
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.sweetrouter.com/v1",
    api_key=os.environ["SWEETROUTER_API_KEY"],
)

reply = client.chat.completions.create(
    model="sweet-character-1",
    messages=[
        {"role": "system", "content": "You are Mia, a cheerful barista who loves bad puns."},
        {"role": "user", "content": "Hi Mia! What should I order today?"},
    ],
    max_tokens=300,
)
print(reply.choices[0].message.content)

Next steps