A complete Go client SDK for the Open WebUI REST API.
Covers all 462 endpoints across 29 domain tags — streaming, auth, Ollama & OpenAI proxies, RAG, and more.
Install • Quickstart • Configuration • API Coverage • Error Handling • Streaming • Support
go get github.com/notfixingit3/openwebui-goRequires Go 1.24 or later.
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/notfixingit3/openwebui-go/client"
)
func main() {
apiKey := os.Getenv("OPENWEBUI_API_KEY")
if apiKey == "" {
log.Fatal("OPENWEBUI_API_KEY not set")
}
c, err := client.New(client.Config{APIKey: apiKey})
if err != nil {
log.Fatal(err)
}
// Check service health (public endpoint, no auth required)
version, err := c.GetAppVersion(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Printf("Open WebUI version: %s\n", version["version"])
}client.Config accepts three fields:
| Field | Default | Description |
|---|---|---|
APIKey |
OPENWEBUI_API_KEY env var |
Bearer token for authenticated endpoints |
BaseURL |
http://localhost:8080 |
Root URL of the Open WebUI server |
HTTPClient |
&http.Client{Timeout: 30s} |
Custom HTTP client (timeouts, TLS, proxies) |
// Custom timeout and TLS config
c, err := client.New(client.Config{
APIKey: "sk-...",
BaseURL: "https://openwebui.example.com",
HTTPClient: &http.Client{
Timeout: 60 * time.Second,
Transport: &http.Transport{TLSClientConfig: &tls.Config{...}},
},
})The SDK covers all 462 endpoints across 29 domain tags.
| Domain | Endpoints | Key Operations |
|---|---|---|
| analytics | 8 | Daily stats, messages, models, tokens, users |
| audio | 6 | TTS, STT, voices, config |
| auths | 21 | Signin, signup, OAuth, LDAP, API keys |
| automations | 8 | CRUD, toggle, runs |
| calendars | 13 | CRUD, events, RSVP |
| channels | 28 | Messaging, threads, reactions, webhooks, members |
| chats | 42 | CRUD, archive, share, clone, tag, search, stats |
| configs | 20 | Server config, banners, connections, code execution |
| evaluations | 16 | Feedback, leaderboard, config |
| files | 12 | Upload, content retrieval, processing, search |
| folders | 7 | CRUD, parent, expanded state |
| functions | 17 | Plugin functions, valves, toggle, sync |
| groups | 10 | CRUD, user membership, export |
| images | 6 | Generation, edit, config |
| knowledge | 17 | Knowledge bases, files, search, reindex, access |
| memories | 7 | CRUD, query, reset |
| models | 14 | CRUD, tags, profile images, base models, import/export |
| notes | 9 | CRUD, pin, search, access |
| ollama | 43 | Proxy: chat, generate, embeddings, model management |
| openai | 12 | OpenAI-compatible proxy, chat completions, audio |
| pipelines | 8 | Add, upload, valves |
| prompts | 17 | Prompt templates, history, versioning, tags |
| retrieval | 16 | RAG: embeddings, process file/text/web/youtube |
| skills | 9 | CRUD, access, toggle, export |
| tasks | 11 | Auto-title, emoji, tags, follow-up, MOA completions |
| terminals | 8 | Terminal server proxy |
| tools | 15 | Tool plugins, valves, access, load from URL |
| users | 21 | CRUD, groups, permissions, settings, profile images |
| utils | 6 | DB download, code execute/format, markdown, PDF |
All generated request and response types live in internal/gen and are re-exported through the client package where appropriate.
Non-2xx responses are returned as *client.HTTPError, which exposes the status code and raw response body.
var httpErr *client.HTTPError
if errors.As(err, &httpErr) {
fmt.Printf("HTTP %d: %s\n", httpErr.StatusCode, string(httpErr.Body))
}Validation errors (422) include structured detail:
var valErr *client.HTTPValidationError
if errors.As(err, &valErr) {
for _, d := range valErr.Detail {
fmt.Printf("Field %v: %s\n", d.Loc, d.Msg)
}
}Chat completions and Ollama generate/chat endpoints support NDJSON streaming. The SDK returns two channels: one for events and one for errors.
events, errs := c.StreamChatCompletion(ctx, body)
for {
select {
case event, ok := <-events:
if !ok { return }
fmt.Printf("Type: %s, Data: %s\n", event.Type, string(event.Data))
case err, ok := <-errs:
if !ok { return }
log.Fatal(err)
}
}See examples/streaming/main.go for a complete runnable example with graceful shutdown on SIGINT.
examples/basic/main.go— Create a client, call a public endpoint, and handle errors.examples/streaming/main.go— Stream chat completions with graceful shutdown.
If you find this SDK useful, consider buying me a coffee to support ongoing development.
Thank you!
MIT © 2026 notfixingit3
