EN ▾
Get API key

Open WebUI API Key: Connect It to Our API

To use an Open WebUI API key with this service, add an OpenAI connection in the admin settings, paste the base URL and your key, and pick the model. It takes about two minutes.

Updated

A chat window connected by a cable to a glowing key and a server cube, illustrating an API key connection

Key points

  • In Open WebUI the key goes into Admin Settings, Connections, as an OpenAI API connection.
  • Use https://api.minicpm.cc/v1 as the URL and uncensored as the model ID.
  • Docker users can set OPENAI_API_BASE_URL and OPENAI_API_KEY instead of clicking through the UI.
  • A new account can claim $0.50 of trial credit with one click, no card needed.

What you need before you start

Open WebUI is a self-hosted chat front end. It does not ship its own model. It talks to whatever backend you point it at, and one of the backends it supports is any server that speaks the OpenAI chat completions protocol. That is what this API is, so the work comes down to three values: a base URL, a key and a model ID.

  • Base URL: https://api.minicpm.cc/v1
  • API key: created on the API key page after you sign up with Google or with email and password.
  • Model ID: uncensored

A short note on the word "key", because the search term can mean two things. The key you paste into Open WebUI is a key for the backend, here this API. It is not a key issued by Open WebUI itself. Open WebUI does have its own per-user API keys for calling Open WebUI from scripts, and those are a separate feature. If you landed here wanting to know where to put a provider key so the chat window can answer, you are in the right place.

You also need a running Open WebUI instance, version recent enough to have the Connections screen in the admin settings. If you do not have one yet, the Docker command in the third section gets you there.

Get the key

Sign up on the get-an-API-key page. After sign-up, the key page shows a button that claims $0.50 of trial credit. It is one click, one per person, valid for 7 days, and it needs no card. That is enough for a few thousand short chat messages, so you can finish the whole Open WebUI setup and use it for real before paying anything.

Copy the key once it is created and keep it somewhere private. Treat it like a password: anyone holding it can spend your balance. If you paste it into a shared Open WebUI server, remember that every user with access to the model list can use the connection, and the cost lands on your balance.

The trial key has lower limits than a full key: 2 concurrent requests and 60 requests per minute. For a single person chatting this is invisible. A full key allows 8 concurrent requests and 300 requests per minute, which matters if several people share one Open WebUI instance.

Add the connection in the admin panel

Menu names change a little between Open WebUI releases, so follow the idea if your labels differ slightly.

  1. Log in to Open WebUI as an administrator.
  2. Open your profile menu and go to Admin Settings, then Connections.
  3. Find the OpenAI API section and add a new connection with the plus button.
  4. In the URL field enter https://api.minicpm.cc/v1. Do not add /chat/completions to it. Open WebUI appends the paths itself.
  5. In the key field paste your API key.
  6. Press the verify button next to the fields. A green confirmation means Open WebUI could call GET /v1/models with your key.
  7. Save.

Open WebUI then asks the backend for its model list. This API returns one model, uncensored, so that is the only entry you will see in the model picker at the top of a new chat. Select it and send a message. If you get a reply, you are done.

If you would rather restrict the list, most versions let you add a model ID filter on the connection. With a single model this is rarely needed.

Set it with Docker variables instead

If you run Open WebUI in Docker, you can skip the clicking and pass the connection as environment variables. On first start the values are read into the saved configuration.

# model ID to pick in the UI: uncensored
docker run -d -p 3000:8080 \
  -e OPENAI_API_BASE_URL="https://api.minicpm.cc/v1" \
  -e OPENAI_API_KEY="YOUR_KEY" \
  -v open-webui:/app/backend/data \
  --name open-webui \
  ghcr.io/open-webui/open-webui:main

Then open http://localhost:3000, create the first account (it becomes the admin) and start a chat with the uncensored model.

One thing catches people out. Open WebUI stores settings in its data volume. After the first run, values you change in the admin panel take priority over the environment variables on later starts, unless you tell it to keep reading the environment. So if you edit the key in Docker and nothing changes, edit it in the Connections screen too, or recreate the volume if you do not mind losing chats.

Test the key outside Open WebUI first

When a connection fails, it helps to know whether the problem is the key or the front end. Run one request from a terminal. If it works there, the key and URL are fine and the issue is in the Open WebUI settings.

curl https://api.minicpm.cc/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Say hello in five words."}]
  }'

You can check the model list the same way with curl https://api.minicpm.cc/v1/models -H "Authorization: Bearer YOUR_KEY", which is the call Open WebUI makes when you press verify.

A Python version using the OpenAI SDK, useful if you plan to script against the same key later:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.minicpm.cc/v1",
    api_key="YOUR_KEY",
)

reply = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(reply.choices[0].message.content)

The full parameter list and streaming examples are in the quickstart docs.

Fixing common connection errors

The verify button fails or the model list is empty

Check the URL first. It must end in /v1 and nothing else. A trailing slash is usually fine, but an extra /chat/completions is not. If Open WebUI runs in Docker and you are testing against a service on the same machine, remember that localhost inside the container is the container itself. That does not apply here, since the API is on the public internet, but it explains many unrelated failures people report.

401 Unauthorized

The key was pasted with a leading or trailing space, or an old key is still saved. Re-enter it. The header the API expects is Authorization: Bearer <key>, and Open WebUI builds that for you.

429 errors in a shared instance

The API answers 429 with the code rate_limited when you pass the per-minute request limit, and with concurrency when too many requests run at once. With a trial key the limit is 2 at once, so two people streaming replies at the same time can hit it. A streamed reply holds its slot until the stream ends. A full key allows 8 at once. A 429 with a Retry-After: 5 header means temporary overload, and waiting five seconds and retrying is the right move.

Replies stop early or seem to forget the conversation

The context window is 100,000 tokens, prompt plus reply. Long chats with large pasted documents can reach it. Start a new chat or trim the history. You do not have to set max_tokens; the reply can use whatever room is left.

What it costs to chat through Open WebUI

Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, paid from prepaid credit with no subscription. Failed or refused requests are not charged, and credit never expires.

Open WebUI resends the whole conversation with each message, so input tokens grow as a chat gets longer. Here is a deliberately long example: a chat that adds up to 10,000 input tokens and 2,000 output tokens across a session.

  • Input: 10,000 / 1,000,000 x $0.15 = $0.0015
  • Output: 2,000 / 1,000,000 x $0.50 = $0.0010
  • Total: $0.0025

That is a quarter of a cent. Even a heavy day with fifty sessions like that comes to $0.125. Each response includes an X-Balance-USD header, so you can watch the balance drop without opening the dashboard. For top-up amounts and bonuses, see the pricing page. You can add any whole amount from $20 to $500 by crypto.

Prompts sent through the API are not used for training. Your Open WebUI chat history stays in your own instance, since that is where the data volume lives.

Questions and answers

Where do I paste an API key in Open WebUI?

Go to Admin Settings, then Connections, and add an OpenAI API connection. Enter the base URL and the key in the two fields, verify, and save.

Is the Open WebUI API key the same as the key from this service?

No. Open WebUI can issue its own keys for calling Open WebUI itself. The key you paste into a connection is the backend key, which you create on this site.

Which model name do I choose in Open WebUI?

Pick uncensored. It is the only model the API lists, so it is the only entry in the picker once the connection is saved.

Do I need a card to try it with Open WebUI?

No. A new account can claim $0.50 of trial credit with one click on the API key page. It is valid for 7 days.

Can several people share one connection?

Yes, but they share the balance and the limits. A full key allows 8 concurrent requests and 300 requests per minute.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Start with trial credit

Email and password, key on screen right away.