Getting Started with OpenRouter
Create your OpenRouter account, generate your first API key, and make your first API call to an AI model in under 5 minutes.
Step 1: Create Your Account
Getting started with OpenRouter is straightforward:
-
Visit OpenRouter
Go to openrouter.ai and click Sign Up or Log In.
-
Choose Sign-In Method
You can sign up with Google, GitHub, or email. GitHub is popular among developers as it connects your coding identity.
-
Complete Registration
Follow the prompts to finish creating your account. No credit card is required — you can start with free models immediately.
Step 2: Get Your API Key
Once logged in, you need to generate an API key:
-
Navigate to API Keys
Go to openrouter.ai/keys or click on your profile and select Keys.
-
Create a New Key
Click Create Key. Give it a descriptive name like "Development" or "Cline". You can optionally set a credit limit.
-
Copy and Save Your Key
Copy the key immediately — it starts with
sk-or-. You will not be able to see it again after leaving the page.
Step 3: Your First API Call
Let's make your first API call using curl. Replace YOUR_API_KEY with the key you just created:
curl https://openrouter.ai/api/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "meta-llama/llama-4-scout", "messages": [ { "role": "user", "content": "Hello! What can you help me with?" } ] }'
This example uses meta-llama/llama-4-scout, which is a free model — perfect for testing without spending credits. You should receive a JSON response with the model's reply.
{
"id": "gen-abc123...",
"model": "meta-llama/llama-4-scout",
"choices": [
{
"message": {
"role": "assistant",
"content": "Hello! I can help you with a wide variety of tasks..."
}
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 52,
"total_tokens": 66
}
}
Understanding Credits and Billing
OpenRouter uses a credit-based system for billing:
- Free models: Several models are available at no cost, including variants of Llama and other open-source models. These are ideal for learning and development.
- Pay-as-you-go: For paid models, you add credits to your account. You are charged per token (input and output) based on each model's pricing.
- No minimums: There are no minimum spending requirements. Add $5 or $500 — you only pay for what you use.
- Credit limits: You can set spending limits on individual API keys to prevent unexpected charges.
Free Models Available
OpenRouter offers several free models that are great for getting started and testing:
| Model | Provider | Best For |
|---|---|---|
| Llama 4 Scout | Meta | General chat, coding, reasoning |
| Gemma 3 | Lightweight tasks, quick responses | |
| Mistral Small | Mistral | Multilingual, general tasks |
| Qwen 2.5 | Alibaba | Coding, math, multilingual |
Dashboard Overview
The OpenRouter dashboard at openrouter.ai gives you access to:
- Activity: View recent API calls, response times, and token usage in real-time.
- Keys: Manage your API keys, set credit limits, and revoke compromised keys.
- Credits: Check your balance, add funds, and view spending history.
- Models: Browse all available models, compare pricing, and view model details.
- Usage: Detailed analytics showing which models you use most, cost breakdowns, and usage trends.
Usage Tracking
Every API call through OpenRouter is logged with detailed information:
- Which model was used
- Input and output token counts
- Cost of each request
- Response time and latency
- Which API key was used
This makes it easy to audit your AI usage, identify expensive calls, and optimize your spending over time.
Lilly Tech Systems