EN ▾
Get API key

Open WebUI and n8n With an OpenAI-Compatible API

Open WebUI and n8n both accept a custom OpenAI endpoint, so one key can serve a chat interface for people and an automation engine for workflows. This page covers the settings for each, plus the limits to plan around when they share a key.

Updated

A chat panel and a workflow node graph both connected to one central server cube

What you need before either tool

The two tools do different jobs. Open WebUI is a self-hosted chat front end where you or your team talk to models. n8n is a workflow engine where a model is one step among triggers, filters and API calls. People often run the two side by side on the same server, and both can point at the same OpenAI-compatible backend.

The values are identical for both:

  • Base URL: https://api.qwennsfw.cc/v1
  • API key: from the key page. New users can claim $0.50 of trial credit there with one click, one per person, valid for 7 days, with no payment needed.
  • Model ID: uncensored

The service has two endpoints, POST /v1/chat/completions and GET /v1/models. It is text only, so features in either tool that rely on image generation, speech or embeddings need another provider. Behind the endpoint is one open-weight model run by an independent provider, tuned to answer without content refusals for lawful adult use. It is not an official endpoint of Qwen or any other vendor.

Open WebUI: add the connection in the interface

  1. Sign in to Open WebUI as an admin and open the Admin Settings, then the Connections page.
  2. In the OpenAI API section, add a new connection with the plus button.
  3. Enter https://api.qwennsfw.cc/v1 as the URL and paste your key.
  4. Save. Open WebUI asks the endpoint for its model list through GET /v1/models, and uncensored should appear in the model picker of a new chat.

If the model list stays empty, add uncensored manually in the connection's model ID list, if your version offers that field. Labels shift between releases, so match them by meaning: you want a connection of the OpenAI type with a custom URL.

Or set it with Docker environment variables

For a fresh deployment you can pass the endpoint at startup so every user sees it on first login. The two variables Open WebUI reads for this are OPENAI_API_BASE_URL and OPENAI_API_KEY:

docker run -d -p 3000:8080 \
  -e OPENAI_API_BASE_URL="https://api.qwennsfw.cc/v1" \
  -e OPENAI_API_KEY="YOUR_KEY" \
  -v open-webui:/app/backend/data \
  --name open-webui \
  ghcr.io/open-webui/open-webui:main

Settings saved in the admin interface can take priority over the variables after the first start, which is why it is worth checking the Connections page if you change the key later.

Open WebUI: settings that affect cost

Every message in a chat resends the earlier turns as input, so long conversations get more expensive per message even when your question is short. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. A 30-message chat where history reaches 12,000 tokens by the end sends roughly 180,000 input tokens in total (about 6,000 per message on average) and receives perhaps 15,000 output tokens, which is $0.027 plus $0.0075, about 3.5 cents.

Two habits keep this small. Start a new chat when the topic changes, and avoid pasting large files into a chat you will keep using. The window itself is 100,000 tokens for prompt plus reply, so nothing breaks until you get close to that, but cost rises well before it does. If several people share one key through Open WebUI, remember they also share its limits.

n8n: the OpenAI credential

n8n has an OpenAI Chat Model node meant for its AI Agent and chain nodes. Its OpenAI credential includes a Base URL field, and that is where the custom endpoint goes.

  1. In n8n, create a new credential of the OpenAI API type.
  2. Paste your key into the API key field.
  3. Replace the default Base URL with https://api.qwennsfw.cc/v1.
  4. Add an OpenAI Chat Model node, select that credential and choose the model uncensored. If the dropdown does not list it, switch the model field to expression or ID mode and type it.

Tool calling works through the endpoint, so an AI Agent node with tools attached can ask the model to call them. The API accepts tools and tool_choice, streams tool_calls, and expects results back as messages with role: "tool". n8n's agent node handles that exchange for you. JSON mode, response_format set to json_object, is available too and is useful when a later node parses the model's answer.

n8n: the HTTP Request node for full control

If you prefer to see exactly what is sent, or you need a parameter the chat model node does not expose, use an HTTP Request node. Set the method to POST, the URL to https://api.qwennsfw.cc/v1/chat/completions, and add a header named Authorization with the value Bearer YOUR_KEY (better, store the key in a credential and reference it). Send the body as JSON:

{
  "model": "uncensored",
  "messages": [
    {"role": "system", "content": "You classify support tickets. Reply with JSON only."},
    {"role": "user", "content": "{{ $json.ticket_text }}"}
  ],
  "response_format": {"type": "json_object"},
  "temperature": 0.2,
  "max_tokens": 200
}

The model's answer is at choices[0].message.content in the response. Parse it with the next node, and read the balance from the X-Balance-USD response header if you set the node to return full responses. A low temperature suits classification and extraction, and the same seed value gives you repeatable test runs. The docs list every parameter that is passed through.

Limits when both tools share one key

A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. n8n is the tool most likely to hit those numbers, because a workflow that loops over 200 items will fire requests as fast as nodes finish. A streamed request in Open WebUI also occupies a concurrency slot until the stream ends, so a busy workflow and a few chatting users can crowd each other out.

The API tells you which limit you hit. HTTP 429 with code concurrency means too many requests at once. HTTP 429 with code rate_limited means too many per minute. A 429 with a Retry-After: 5 header marks temporary overload. In n8n, set Retry On Fail with a wait of 5000 ms on the node, and use the Loop Over Items node with a batch size of 4 or 5 so you stay under the concurrency ceiling. The response headers X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency confirm the numbers your key has.

Troubleshooting both setups

  • Connection test fails with 401. The key has a stray space or newline, which is common when pasting from a terminal. Paste it again.
  • 404 on every request. The URL probably ends in a doubled path. For Open WebUI and the n8n credential use the base URL ending in /v1. For the HTTP Request node use the full path ending in /chat/completions.
  • The model list is empty. Type the model ID uncensored by hand. The list comes from GET /v1/models, and some versions cache it.
  • Docker networking. If n8n or Open WebUI runs in a container, it reaches the internet through the container network. A failure to resolve the host is a DNS or proxy problem on your side, not a key problem.
  • Charges on failures. Failed or refused requests are not charged, so you can retry without losing credit.

Budget-wise, top-ups are whole amounts from $20 to $500, paid in crypto with USDT on TRC20 or USDC on Base, with a 5% bonus from $50, 10% from $100 and 15% from $200. The credit never expires. See the pricing page for details, and the API explainer if you are still deciding whether this model fits your project. Prompts are not used for training, and one rule is fixed: no sexual content involving minors.

A first workflow to test the connection

Before you build anything large, wire up a small n8n workflow that proves the whole path works. Use a Webhook trigger, one HTTP Request node configured as above, and a Respond to Webhook node that returns choices[0].message.content. Post a short message to the webhook URL and you should get the model's answer back within a few seconds.

Once that works, price it. Say each run sends 800 input tokens (a system prompt plus the incoming text) and gets 150 tokens back. Input costs 800 x $0.15 / 1M = $0.00012 and output costs 150 x $0.50 / 1M = $0.000075, which makes $0.000195 per run. A thousand runs cost $0.195, so about 20 cents. That is small enough that you can leave the workflow active during development and look at the balance only now and then.

From there, the usual next steps are a Switch node that routes by the model's JSON answer, a loop for batches, and an error branch for 429 responses. If you chat with the same endpoint in Open WebUI while the workflow runs, remember that both draw from one balance, and top up before a long batch instead of in the middle of it.

Questions and answers

Can Open WebUI and n8n use the same API key?

Yes. Both can use the same key and base URL. They then share its limits: 8 concurrent requests and 300 per minute on a full key.

What model name do I enter in n8n?

Enter uncensored. If the dropdown does not list it, type it in expression or ID mode.

Does tool calling work in n8n's AI Agent node?

Yes. The endpoint supports tools, tool_choice and streamed tool_calls, with results returned as role tool messages.

Why does n8n return 429 on a loop of many items?

The loop sends requests faster than your concurrency or per-minute limit allows. Batch the items in small groups and retry after the Retry-After delay.

Can I generate images or embeddings from these tools with this API?

No. The API is text only, so use a different provider for images, audio or embeddings.

Your key is one form away

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

https://api.qwennsfw.cc/v1