What you are about to set up
An API is a web address your program can send text to and get text back from. This one follows the same format as the OpenAI API, so most code examples, libraries and tutorials you find for OpenAI will work here after you change the address and the key. That is the main reason it is a gentle starting point: you are not learning a new tool, only pointing a familiar one somewhere else.
Routers like OpenRouter ask you to choose between many models and providers, each with its own price and behaviour. That choice is useful for experienced users and confusing on day one. Here there is a single model, called uncensored. It is an open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use. It is text only, so no images, audio or video, and no embeddings. One hard rule applies: no sexual content involving minors.
If you need many models from many vendors in one account, a router is the better fit, and it is fine to start there. If you want one simple endpoint to learn on, keep reading.
Step 1: Create an account and claim the trial
Open the API key page and sign up with Google, or with an email and password. After sign-up, the same page shows a button to claim $0.50 of trial credit. It takes one click, lasts 7 days, needs no payment method and is limited to one per person.
Half a dollar sounds tiny, but tokens are cheap. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. A short chat exchange of 500 tokens in and 200 tokens out costs $0.000075 plus $0.0001, which is $0.000175. Dividing $0.50 by that gives about 2,857 exchanges. For learning, that is more than you will use in a week.
While you are on the page, copy your key. Treat it like a password. Anyone who has it can spend your credit, so never paste it into a public repository, a screenshot or a chat message.
Step 2: Send your first request with curl
The fastest check needs no programming language. Open a terminal and store the key in a variable so that you do not retype it. On macOS or Linux:
export API_KEY="paste-your-key-here"
curl https://api.openrouteruncensored.cc/v1/chat/completions -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{
"model": "uncensored",
"messages": [
{"role": "user", "content": "Say hello in three languages."}
]
}'
You should get back a block of JSON. The part you care about is choices[0].message.content, which holds the reply. The rest tells you how many tokens were used (usage) and why the model stopped (finish_reason). If you see that, your key works, the URL is right and the account has credit.
Three words are worth knowing. The base URL is the shared start of every endpoint, here ending in /v1. The model is the name you send in each request. The messages list is the conversation so far, where each item has a role (system, user or assistant) and some content.
Step 3: The same request in Python
Install the official library with pip install openai. Then save this as hello.py:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.openrouteruncensored.cc/v1",
api_key=os.environ["API_KEY"],
)
reply = client.chat.completions.create(
model="uncensored",
messages=[
{"role": "system", "content": "You are a friendly tutor who answers briefly."},
{"role": "user", "content": "What is an API key, in one paragraph?"},
],
temperature=0.7,
)
print(reply.choices[0].message.content)
Run it with python hello.py. The system message sets the behaviour of the assistant for the whole conversation, and temperature controls how varied the answers are. Low values such as 0.2 give steadier, more predictable text, and higher values such as 1.0 give more variety. If you prefer JavaScript, the Node version works the same way: new OpenAI({ baseURL, apiKey }) with the same URL and then client.chat.completions.create with the same fields.
Make it a conversation
The API has no memory between calls. To continue a chat, you send the earlier messages again, including the model's previous replies as assistant messages, followed by the new user message. That is how every chat app built on this format works. It also explains costs: longer conversations mean more input tokens per turn, because you resend the history.
Show the answer as it is written
Add stream=True to get the reply in small pieces, which feels faster in a chat window. Loop over the chunks and print each piece. Streaming uses server-sent events, and usage is reported at the end. Keep in mind that a streamed request counts as one active request until the stream is finished.
Common first errors and how to fix them
Almost everyone meets one of these in the first hour. None of them is serious.
| What you see | Likely cause | Fix |
|---|---|---|
| 401 or an authentication error | Key missing, mistyped or sent without the word Bearer | Re-copy the key and check the header reads Authorization: Bearer YOUR_KEY |
| 404 not found | The path is wrong, often /v1 typed twice or left out | Use exactly https://api.openrouteruncensored.cc/v1 as the base URL and let the library add the rest |
| Model not found or similar | A model name copied from another tutorial | Set model to uncensored |
429 with rate_limited or concurrency | Too many requests per minute, or too many at once | Slow down; a trial key allows 2 at once and 60 per minute |
429 with a Retry-After: 5 header | Temporary overload | Wait five seconds and try again |
Failed or refused requests are not charged, so debugging does not burn your credit. When you ask for help, include the X-Request-Id response header. It lets the team find your exact request. The support page has the contact details.
Step 4: Move beyond the trial
When the trial runs out, add credit. Top-ups are any whole amount from $20 to $500. You get +5% extra from $50, +10% from $100 and +15% from $200. For example, $50 gives $52.50 of credit. You can pay with crypto (USDT on TRC20 or USDC on Base). Credit never expires and there is no subscription, so a $20 top-up can last as long as your project does. The pricing page lists the details.
A full key also raises the limits to 8 concurrent requests and 300 requests per minute. For reference, each response includes an X-Balance-USD header with your remaining credit, which is a handy thing to print while you learn. Prompts you send are not used for training.
The context window is 100,000 tokens for prompt and answer together. For beginner projects you will not come close. A typical page of text is under 1,000 tokens.
What to build next
Pick a small project and finish it. A command-line chatbot that keeps a message list in memory teaches you the whole request cycle in about 20 lines. A script that reads a text file and returns a summary teaches you prompts and token costs. A character chat for a story or a game teaches you system prompts, which is where this model's relaxed refusals matter: a villain can stay a villain, within lawful adult use.
When you want more depth, the docs cover streaming, tool calling and JSON mode (response_format set to json_object) with examples for each. Tool calling lets the model ask your program to run a function, such as looking up the weather, and then use the result in its answer. It is the step that turns a chatbot into an assistant that can do things.
Start small, keep the key out of your code, and read the usage numbers in the first responses. Once you can predict what a request costs, the rest is ordinary programming.
