What Is OpenRouter? How It Works and How to Start
Get an OpenRouter API key, make your first request, and see how provider fallback and data settings change which models your app can use.
Published

OpenRouter is a gateway that lets your app call hundreds of AI models through one API and one key. When a lab says its model is “available on OpenRouter,” you can send it a request through your existing OpenRouter connection by changing the model name.
Get an OpenRouter API key and make your first request
- Create an OpenRouter account and generate a key from the API keys page. For a paid model such as the one in the quickstart, add credits to your account.
- In Bash, run
read -rs -p 'OpenRouter key: ' OPENROUTER_API_KEY, paste the key and press Enter. Runexport OPENROUTER_API_KEYso clients started from that shell can read it. - Send this request from OpenRouter’s quickstart, checked December 3, 2026.
curl https://openrouter.ai/api/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-d '{
"model": "~openai/gpt-sol-latest",
"input": "What is the meaning of life?"
}'The key identifies your account. The model field chooses what answers, and input holds the question. The tilde is intentional. ~openai/gpt-sol-latest follows the newest member of OpenAI’s GPT Sol family. In the returned JSON, look at model to see which version answered and output to find its message. If you need to repeat a comparison next week, record the resolved model ID.
Paid requests draw credits at the provider’s list price, with a fee on credit purchases of 5.5% on Standard or 8% on Business (worked billing examples).
Point the OpenAI Python SDK at OpenRouter
If your app already uses the OpenAI Python SDK, its client library can send the same request. Set the client’s base URL to the OpenRouter API root and pass your OpenRouter key. The SDK adds the path for the operation you call, so leave /responses off the base URL.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=os.environ["OPENROUTER_API_KEY"],
)
response = client.responses.create(
model="~openai/gpt-sol-latest",
input="What is the meaning of life?",
)
print(response.output_text)What is OpenRouter routing for you?
OpenRouter, Inc. operates the gateway. The company announced it was joining Stripe in August 2026. A lab such as OpenAI makes the model. A provider runs the model on servers and returns its answer. Sometimes the lab does both jobs. OpenRouter gives your app one address for reaching those providers.
Think of a model as a score and the provider as the orchestra performing it. If one orchestra cancels, another can play the same score. Choosing a different score changes what the audience hears. OpenRouter makes a similar distinction when a request fails.
Provider fallback keeps your chosen model. If the first host is unavailable, OpenRouter can try another eligible host serving that model. By default, text routing weighs price, time to start answering, output speed and reliability. If a customer agreement permits only one host, you can restrict routing to that provider. You then live with that host’s outages. Provider selection guide

Model fallback gives your app permission to accept a different model. Supply an ordered list of model IDs in models. Under the default ordering, the router tries the first model’s eligible providers before moving to the next model. For a support inbox, that can keep draft replies available during an outage. For an evaluation meant to measure one model, leave the substitute out or you could score the wrong model’s work. Model fallback guide
How to read OpenRouter models before choosing one
Open a model page to see who can serve it. The GPT-6.2 Sol provider table, for example, lists Amazon Bedrock and OpenAI among the hosts. Across each row you can read the price for input and output, how long the provider takes to start responding, how quickly it generates the rest and how often the endpoint is available. If a person is watching a reply appear in a chat window, the wait for the first words matters. For a long report generated overnight, sustained output speed may matter more.
OpenRouter free models
For a first experiment without paying for inference, choose an ID from the catalog filtered to free models and substitute it in the request above. Free access has request limits. A successful sample is enough to check your integration. It tells you little about whether that endpoint can handle your app’s busiest hour.
What the OpenRouter leaderboard measures
The text model rankings count tokens, the chunks of text processed through OpenRouter, over the period you select. A long document can contribute far more tokens than a short chat. Use the chart to find models that developers are using. To choose one for invoice extraction, give your shortlisted models the same anonymized invoice and compare the fields each returns with the original.
Which providers may see a customer’s prompt?
Start with two decisions. What may OpenRouter keep, and which outside providers may receive the request?
At the gateway, private prompt and response logging is off by default. Allowing OpenRouter to use those inputs and outputs for product improvement is a separate opt-in, also off by default. OpenRouter still records request metadata such as token counts and latency. You can therefore investigate a slow request even if its text is absent from your logs. OpenRouter’s data collection guide
At the provider, training and retention are separate permissions. You can exclude providers that train on your inputs, with separate choices for paid and free models. A provider may still keep content for abuse prevention. If a customer requires zero routine storage after processing, enforce Zero Data Retention (ZDR) and choose ZDR only for both Google and the other model group. When enforcing ZDR, self-serve accounts allow Safety Retention endpoints by default. Sending zdr: true follows the account and guardrail choices. Zero Data Retention guide

OpenRouter also describes an exception for material flagged as potential child sexual abuse material. Its screening announcement includes ZDR traffic and allows flagged content to be kept for review, reporting and legal preservation. Optional tools such as web search have their own data policies.
Who should route through OpenRouter?
Use it when model choice is part of the work. A founder deciding which model should draft customer replies can send the same anonymized ticket to different model IDs through the same client. A developer who needs the same model to stay available can instead look for multiple eligible hosts. Count the providers left after applying your privacy settings. A long public provider list can shrink to a single usable route.
Keep a direct integration when your app depends on one approved provider and already works well there. Adding a gateway introduces another service to operate against. If the requirement is control over the gateway itself, the LiteLLM and OpenRouter comparison addresses that decision. Teams evaluating other managed options can compare OpenRouter alternatives or look at how Vercel AI Gateway works.
Arrange hosting separately if you have your own model weights, the files that define a trained model. A catalog listing gives your app access to an existing deployment. OpenRouter’s Enterprise private endpoints can route to your dedicated or fine-tuned deployment of a catalog model. You supply a running endpoint. Uploading weights and getting a server to run them is a hosting provider’s job.
Is OpenRouter safe?
For customer data, check whether your agreement permits both OpenRouter and every eligible provider to process the prompt. Turn off content logging if you do not need it, review training and retention separately, and check any tools the request invokes. If no eligible route meets the agreement, keep that workload on your approved provider.
- Published
- Category
- Build








