> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ruapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Open WebUI

> How to connect self-hosted Open WebUI to RuAPI: set the OpenAI API Base URL or environment variables

[Open WebUI](https://openwebui.com) is a self-hosted web interface for chatting with models. Beyond Ollama it works with any **OpenAI-compatible** API, so RuAPI connects as an OpenAI connection — just an address and a key.

## Prerequisites

<Steps>
  <Step title="RuAPI account and API key">
    Console → **Tokens** → create an `sk-...` key. The balance tops up in USDT — see [Top-up](/en/topup).
  </Step>

  <Step title="A running Open WebUI">
    Install per the [Open WebUI docs](https://docs.openwebui.com) (usually Docker).
  </Step>
</Steps>

## Option 1: through the UI

<Steps>
  <Step title="Open connection settings">
    **Admin Panel → Settings → Connections** (or Settings → Connections for the current user).
  </Step>

  <Step title="Add an OpenAI connection">
    Enable the OpenAI API and enter:

    | Field            | Value                                       |
    | ---------------- | ------------------------------------------- |
    | **API Base URL** | `https://www.ruapi.ai/v1`  — **with** `/v1` |
    | **API Key**      | `sk-your-key`                               |

    Save. Open WebUI pulls the model list via `/v1/models`.
  </Step>
</Steps>

## Option 2: through environment variables

When starting the container, set:

```bash theme={null}
docker run -d -p 3000:8080 \
  -e OPENAI_API_BASE_URL=https://www.ruapi.ai/v1 \
  -e OPENAI_API_KEY=sk-YOUR_KEY \
  -v open-webui:/app/backend/data \
  --name open-webui ghcr.io/open-webui/open-webui:main
```

## Verify

Start a new chat, pick a model (e.g. `claude-opus-4-8`) and send a message. A reply plus an entry in RuAPI Console → **Logs** means it works.

## Troubleshooting

<AccordionGroup>
  <Accordion title="The model list is empty">
    * Check the Base URL is `https://www.ruapi.ai/v1` with `/v1`: models are fetched via `/v1/models`.
    * The key must be a RuAPI token (`sk-...`).
  </Accordion>

  <Accordion title="401 / auth error">
    The key is wrong or has spaces. Check its state in RuAPI Console → **Tokens**.
  </Accordion>

  <Accordion title="I want to keep both Ollama and RuAPI">
    You can: Open WebUI supports several connections at once. Local Ollama models and cloud RuAPI models show up in the same picker.
  </Accordion>
</AccordionGroup>
