@@ -14,7 +14,7 @@ The chart only creates custom resources that rely on these systems being install
1414- [ cert-manager] ( https://cert-manager.io/ ) with a ` ClusterIssuer ` matching ` envoy.clusterissuer `
1515- A PostgreSQL server, with roles and databases created up front. See [ postgresql.md] ( docs/postgresql.md )
1616
17- ## Usage
17+ ## Installation
1818
1919The repository contains a [ ` justfile ` ] ( justfile ) to automate routine commands.
2020You may use it as reference, or run it with ` just ` (by default, just will list available recipes).
@@ -97,3 +97,56 @@ just to make sure the user is created in openwebui.
9797click on the user icon in the bottom left, go to "Admin Panel" -> "Settings" -> "Models". For each model, click on the
9898Pen icon to edit, then the "Access" button in the top right. Set to "Public", close and "save". This has to be done each
9999time models are changed.
100+
101+ ## Usage
102+
103+ ### Web interface
104+
105+ Open ` https://openwebui.<baseDomain>` and sign in with the "authentik" button, which
106+ delegates to GitLab. The first sign-in creates the account; accounts are matched by
107+ email, so signing in a different way later does not create a duplicate.
108+
109+ Members of the `gateway admins` group in authentik become OpenWebUI admins.
110+
111+ Newly added models stay private until an admin makes them public once, see
112+ [Manual installation steps](#manual-installation-steps).
113+
114+ A model that has scaled to zero takes a minute or two to answer the first message.
115+
116+ # ## API access
117+
118+ The gateway at `https://gateway.<baseDomain>/v1` speaks the OpenAI API and takes an
119+ authentik access token as its bearer credential. `GET /v1/models` lists the model names to
120+ use; they are the `models.*.fullName` values.
121+
122+ Get a token with the device code flow. `CLIENT_ID` is `authentik.oauthApp.clientId` -- a
123+ public client, so it is not a secret :
124+
125+ ` ` ` bash
126+ DOMAIN=<baseDomain>
127+ CLIENT_ID=<authentik.oauthApp.clientId>
128+
129+ # 1. start the flow, then open verification_uri_complete in a browser and approve
130+ curl -s "https://authentik.$DOMAIN/application/o/device/" \
131+ -d client_id="$CLIENT_ID" -d scope="openid profile email offline_access" \
132+ | tee /tmp/dev.json | jq
133+
134+ # 2. exchange the device code for a token (returns authorization_pending until approved)
135+ TOKEN=$(curl -s "https://authentik.$DOMAIN/application/o/token/" \
136+ -d grant_type=urn:ietf:params:oauth:grant-type:device_code \
137+ -d client_id="$CLIENT_ID" \
138+ -d device_code="$(jq -r .device_code /tmp/dev.json)" | jq -r .access_token)
139+
140+ curl "https://gateway.$DOMAIN/v1/chat/completions" \
141+ -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
142+ -d '{"model":"<fullName>","messages":[{"role":"user","content":"hello"}]}'
143+ ` ` `
144+
145+ Or point any OpenAI client at it :
146+ ` OpenAI(base_url=f"https://gateway.{DOMAIN}/v1", api_key=TOKEN)` .
147+
148+ The token is yours, so rate limits and usage are attributed to you. Access tokens last
149+ ` authentik.oauthApp.accessTokenValidity` (30 days by default); the device grant also
150+ returns a refresh token, valid for `refreshTokenValidity`, so a client can renew without
151+ a second browser approval. A model that has scaled to zero takes a minute or two to answer
152+ the first request.
0 commit comments