Get an API key & make your first free-model call
From zero to a model answering — on a free model, no card needed
OpenRouter is an API gateway: one API key and one OpenAI-compatible endpoint that reaches hundreds of models across every major provider (Claude, GPT, Gemini, Llama, Mistral, NVIDIA Nemotron, Gemma). You don't describe an app and watch it build — you send a chat request and a model answers. The fastest way to feel that is to call one of the many genuinely free models — their ids end in :free and cost $0 for both prompt and completion. No paid subscription is required to get a first reply.
- 1 Create an account at openrouter.ai and sign in.
- 2 Create an API key in your account settings (the Keys section). Copy it somewhere safe — treat it like a password; never paste it into a shared workflow.
- 3 Pick a free model. Open the model catalogue at
https://openrouter.ai/api/v1/models(or the catalogue on the site) and find an id ending in:free— for examplegoogle/gemma-4-31b-it:free. These cost $0 prompt + $0 completion. - 4 Send your first request from a terminal:
`curl https://openrouter.ai/api/v1/chat/completions \ -H 'Authorization: Bearer YOUR_KEY' \ -H 'Content-Type: application/json' \ -d '{ "model": "google/gemma-4-31b-it:free", "messages": [{"role": "user", "content": "Summarise the role of p53 in tumour suppression in 3 sentences."}] }'` - 5 Read the reply. The answer text is in the
choices[0].message.contentfield of the JSON response. You just reached a hosted LLM through one endpoint, for free.
You received a coherent JSON response from a `:free` model via `https://openrouter.ai/api/v1/chat/completions`, and you know where your API key is stored.
What a gateway is — and why one endpoint reaches every model
Before changing anything, get clear on what you just used. OpenRouter is not a chat app and not an app-builder. It is a router that sits in front of every provider and speaks the OpenAI API format on their behalf.
One API key + one OpenAI-compatible `/api/v1/chat/completions` endpoint stands in front of hundreds of models from all the major providers. Because the request format is the OpenAI standard, any tool that can talk to OpenAI — the Python `openai` package, n8n's HTTP Request node, Hermes, AnythingLLM, your own scripts — can talk to OpenRouter by changing only the base URL and key. The model you reach is chosen by the `model` field in the request body, not by a different endpoint or a different account.
- ?Your curl request named
google/gemma-4-31b-it:free. What single thing would you change to ask Claude the same question instead? - ?Why does an OpenAI-compatible endpoint mean you can point existing tools (n8n, Hermes) at OpenRouter without rewriting them?
- ?Many models carry a
:freesuffix — browse the live list at openrouter.ai/models to see how many right now. What do you think you are trading away by using a free model versus a paid one? (Guess now — you will compare them directly in a later lesson.)
Make the call from your own language, then change the question
A curl call proves the endpoint works. The real goal is to call it from the place you actually work — a script — so you can reuse it.
Call a free OpenRouter model from a short Python script (or your language of choice) using the OpenAI SDK, then run a real question from your own work through it.
- 1 Install the OpenAI SDK if needed (
pip install openai). - 2 Point the client at OpenRouter:
`python from openai import OpenAI client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key="YOUR_KEY") resp = client.chat.completions.create( model="google/gemma-4-31b-it:free", messages=[{"role": "user", "content": "Explain mRNA translation in 2 sentences."}] ) print(resp.choices[0].message.content)` - 3 Run it and confirm you get the same kind of reply you saw from curl.
- 4 Replace the prompt with a genuine question from your research and run it again.
A working script that calls a `:free` OpenRouter model and prints the answer to a real question from your own work.