Lovely RouterDocs
Get a key
Get started

Quickstart

Create an API key, make your first request with the SDK you already use, and check what it cost.

You need an account and an API key. Post about Lovely Router on X to get $2 of free credit, enough for hundreds of requests to a small model (how).

  1. Create an API key

    Sign up, then open API keys in the dashboard and click New key. Copy the key right away: it starts with lr- and is shown only once.

    Store it in an environment variable so it stays out of your code:

    Shell
    export LOVELY_API_KEY="lr-..."
  2. Send your first request

    Lovely Router speaks the Anthropic, OpenAI and Gemini APIs natively. Pick the one your code already uses and change only the base URL and the key.

    curl https://lovelyrouter.com/v1/chat/completions \
      -H "Authorization: Bearer $LOVELY_API_KEY" \
      -H "content-type: application/json" \
      -d '{
        "model": "gpt-6.1-sol",
        "messages": [{"role": "user", "content": "Write a haiku about routers."}]
      }'

    The same key works for every model. To call Claude with the Anthropic SDK or Gemini with the Google SDK, see Anthropic Messages and Gemini.

  3. Stream the response

    Add stream: true to get tokens as they are generated. Streaming works the same way it does with the vendor's own API.

    curl -N https://lovelyrouter.com/v1/chat/completions \
      -H "Authorization: Bearer $LOVELY_API_KEY" \
      -H "content-type: application/json" \
      -d '{"model": "gpt-6.1-sol", "stream": true,
           "messages": [{"role": "user", "content": "Count to ten, slowly."}]}'
  4. Check the cost

    Every request appears in Logs within a few seconds, with its tokens, charge, time to first token and throughput. Each response also carries an x-lovely-request-id header. Include it when you contact support about a specific call.

Pick a model#

Call GET /v1/models for the live list with context sizes and prices, or browse the marketplace. Model ids are forgiving: claude-sonnet-5.5, claude-sonnet-5-5 and anthropic/claude-sonnet-5.5 all resolve to the same model.

cURL
curl https://lovelyrouter.com/v1/models

Next steps#