Guide

Set up a free AI model with OpenRouter.

Pick a model, create an API key, paste the base URL and model ID into your app, then run a small test request.

Fact checked July 15, 2026

The whole flow

Most setup problems come from one missing value: the wrong model ID, the wrong base URL, or an API key pasted into the wrong place.

01

Choose a free AI model

Open the model directory, compare context length and modalities, then copy the exact model ID. Use an exact ID when you need predictable behavior.

Browse free models
02

Create an OpenRouter API key

If you do not have an OpenRouter account yet, create one first. Then sign in, create an API key, and keep it server-side or in your local environment.

Open API keys
03

Fill your app settings

Paste the base URL, API key, and model ID into the place where your app or SDK asks for OpenAI-compatible API settings.

04

Run one small test

Send a short prompt first. If the request works, then increase tokens, add real prompts, and handle quota or rate-limit errors.

Values to paste

These are the three values most apps, SDKs, and workflow tools need.

Base URL
https://openrouter.ai/api/v1

Use this where a tool asks for an OpenAI-compatible base URL.

API key
OPENROUTER_API_KEY

Store the key as an environment variable or server-side secret.

Model ID
openrouter/free

Replace this with the exact free model ID you choose from the directory.

Exact model or router

Use a specific free model ID when you care which model answers. Use the free router only when any compatible free model is acceptable.

Specific model ID

publisher/model:free

Best for coding, testing, comparisons, and any workflow where model identity matters.

Free router

openrouter/free

Best for quick experiments where the upstream service can choose a currently available free model for you.

Test request

Run a short request before wiring this into a real workflow.

cURL
curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openrouter/free",
    "messages": [
      {"role": "user", "content": "Reply with exactly: setup-ok"}
    ],
    "max_tokens": 16
  }'

If it fails

Most first-run failures are configuration errors, not model problems.

  • A 401 usually means the API key is missing, expired, or pasted in the wrong environment.
  • A 404 or model error usually means the model ID was copied incorrectly or the selected model is no longer available.
  • A 429 means quota or rate limit. Wait, reduce retries, or choose a different model.
  • If your tool has separate fields, put the base URL in the base URL field, not in the model field.
Choose a free AI model