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).
Create an API key
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.
Shellcurl 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.
Stream the response
Add
stream: trueto get tokens as they are generated. Streaming works the same way it does with the vendor's own API.Shellcurl -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."}]}'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-idheader. 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 https://lovelyrouter.com/v1/models