name: pwn-ai-providers-openwebui description: Drive PWN::AI::Providers::OpenWebUI from pwn_eval. license: MIT allowed-tools: [pwn, pwn_eval] metadata: bundled: true generated: false preserve: true module: PWN::AI::Providers::OpenWebUI source: pwn/ai/providers/open_web_ui.rb
PWN::AI::Providers::OpenWebUI
Client for Open WebUI's REST API via PWN::HTTP::TransparentBrowser (:rest). Live Open WebUI routes (gateway base_uri, no trailing slash): GET /api/v1/models OpenAI-compat model list (:data) POST /api/v1/chat/completions OpenAI-compat chat (SSE when stream:true) POST /api/chat/completions alias of the above GET /ollama/api/tags proxied Ollama tags (:models) POST /ollama/api/chat proxied Ollama chat (NDJSON when stream:true) POST /ollama/api/embed proxied embeddings (see PWN::AI::Memory::Index) Bare /api/chat and bare /v1/* are NOT API routes on stock Open WebUI — they 405 or return the SPA HTML shell.
When to use
Call PWN::AI::Providers::OpenWebUI from pwn_eval when the task needs this module.
Do not reimplement it in shell.
Catalog authentication
Use the gateway's ai.openwebui.base_uri and a gateway-issued API key or JWT
in ai.openwebui.key. For get_models and get_model only, an authorized
operator can instead exchange their own IdP access token. First confirm that
the gateway administrator enabled exchange and explicitly listed the OAuth client
in its trusted client IDs. Configure its HTTPS base_uri, ai.openwebui.oauth.provider
(the gateway's provider ID) and enroll: true. Run get_models in a private
foreground terminal; enter the IdP token only at the masked prompt. It is sent
directly over verified TLS to that gateway and never persisted by PWN.
Only the gateway-issued bearer, finite expiry and gateway URI are cached.
get_model uses the same session as get_models, including when it looks up a
missing detail in the gateway's lists. Neither operation retries a denied or
expired session with key:. On denial, disabled exchange, redirect or MFA, stop
and use normal web sign-in. Do not put the IdP token in key:. Chat and other
noncatalog calls still need the gateway-issued key/JWT.
How to call
PWN::AI::Providers::OpenWebUI.get_models(non_interactive: true).length
Public methods
obtain_oauth_bearer_token(explicit operator exchange; returns a secret)get_modelsget_modelchat_with_toolschatauthorshelp
Source
pwn/ai/providers/open_web_ui.rb
Verification
The example counts rows from the gateway's model list or proxied tag catalog. It does not initiate an exchange or test generation permissions.
