Skip to main content

Overview

Open WebUI supports OpenAI’s API and any OpenAI-compatible API endpoints, including Azure OpenAI, Anthropic, Google AI, and custom providers.

Quick Start

1

Get API Key

Obtain an API key from your provider (OpenAI, Azure, etc.)
2

Configure Environment

Set the API key and base URL
3

Enable OpenAI API

Enable in Admin Panel or set ENABLE_OPENAI_API=True

Configuration

OpenAI

Azure OpenAI

Azure OpenAI requires deployment names. The model ID in Open WebUI should match your Azure deployment name.File: backend/open_webui/routers/openai.py:800

Advanced Configuration

Authentication Types

Open WebUI supports multiple authentication methods:
File: backend/open_webui/routers/openai.py:149

Custom Headers

Add custom headers to API requests:

Model Filtering

Specify which models to expose:

Connection Types

Tag connections as local or external:
File: backend/open_webui/routers/openai.py:421

OpenAI-Compatible Providers

Anthropic

Open WebUI automatically detects Anthropic URLs and uses appropriate model mapping. File: backend/open_webui/routers/openai.py:96

Google AI (Gemini)

OpenRouter

OpenRouter requires specific headers:
File: backend/open_webui/routers/openai.py:134

Local Providers

Reasoning Models (o1, o3)

Open WebUI automatically handles OpenAI’s reasoning models:
File: backend/open_webui/routers/openai.py:101

Responses API

For providers supporting OpenAI’s Responses API:
Automatic conversion from Chat Completions to Responses API format: File: backend/open_webui/routers/openai.py:827

API Endpoints

Model Management

  • GET /openai/models - List available models
    File: backend/open_webui/routers/openai.py:556
  • POST /openai/verify - Verify connection and API key
    File: backend/open_webui/routers/openai.py:659

Completions

  • POST /openai/chat/completions - Chat completions
    File: backend/open_webui/routers/openai.py:936
  • POST /openai/responses - Responses API (experimental)
    File: backend/open_webui/routers/openai.py:1256

Audio

  • POST /openai/audio/speech - Text-to-speech
    File: backend/open_webui/routers/openai.py:272

Embeddings

For RAG and semantic search:
File: backend/open_webui/routers/openai.py:1151

Troubleshooting

  1. Verify the API key format
  2. Check for leading/trailing whitespace
  3. Ensure the key has necessary permissions
  4. Test with the provider’s verify endpoint
OpenAI API filters out certain models by default:
  • Embedding models
  • TTS/Whisper models
  • DALL-E models
  • Legacy babbage/davinci models
File: backend/open_webui/routers/openai.py:505
Common issues:
  • Deployment name doesn’t match model ID
  • Incorrect API version
  • Missing api-key header for non-Entra auth
  • Unsupported parameters for API version
Allowed parameters vary by API version.File: backend/open_webui/routers/openai.py:754
Open WebUI respects provider rate limits. Consider:
  • Using multiple API keys with load balancing
  • Implementing backoff in Pipelines
  • Monitoring usage through provider dashboard

Advanced Features

Logit Bias

Control token generation probabilities:
File: backend/open_webui/routers/openai.py:1058

User Info Forwarding

Forward user context to API:
Headers:
  • X-OpenWebUI-User-Name
  • X-OpenWebUI-User-Id
  • X-OpenWebUI-User-Email
  • X-OpenWebUI-User-Role
  • X-OpenWebUI-Chat-Id
File: backend/open_webui/routers/openai.py:80

Model Caching

Models are cached for performance:
File: backend/open_webui/routers/openai.py:482

Best Practices

Use Environment Variables

Keep API keys in environment variables, not in database

Multiple Keys

Configure multiple API keys for load balancing and redundancy

Model Access Control

Use Open WebUI’s RBAC to control model access per user

Monitor Costs

Track usage through provider dashboards and OpenTelemetry