Model API
Assistant on a model vendor’s API
Open WebUI as the interface, a LiteLLM gateway holding the vendor key and the spend log, a closed model (GPT-5, Claude Sonnet or Gemini) reached over its API, and pgvector for retrieval over your own documents. The application is identical to a self-hosted one; only the model moves to a vendor endpoint.
- Source
- Editorial recipe — no step evidence has been fetched yet
- Verified
- Evidence not verified
- Confidence
- Low
01Objective
Give the company an assistant you build and host — interface, retrieval, identity and logging all yours — that calls a closed frontier model over the vendor’s API for the reasoning itself.
- use caseDocument Q&AAsk questions of a specific document or a small set of them and get an answer with the passage it came from. Narrower than company-wide search: the user already knows which file matters and wants it read carefully.
- use caseEmail draftingDrafting replies in the inbox from the thread, the CRM record and the company style. Small per message, large in aggregate — and the place where a wrong statement leaves the building fastest.
- use caseInternal company searchOne search box over the documents a company already has — shared drives, wikis, ticket systems, email attachments — answered by a model that quotes the source. The value is finding the right paragraph in a corpus nobody has read end to end, not writing new text.
- use casePrivate company ChatGPTA chat assistant for staff that behaves like a consumer chatbot but runs under company control: your accounts, your logging, your retention, your choice of model, and optionally your own documents attached.
02Recommended stack
| Role | Component |
|---|---|
| Authentication | Existing identity provider via OIDC |
| Gateway | LiteLLM |
| Inference | Closed model API (OpenAI, Anthropic or Google Gemini) |
| Ui | Open WebUI |
| Vector store | PostgreSQL with pgvector |
Architecture and data flow
Components
- Employees (office network) — people
- Assistant application (Open WebUI + LiteLLM gateway) — application
- Existing identity provider (OIDC) — identity
- Retrieval layer — retrieval
- PostgreSQL + pgvector (embeddings) — vector store
- PostgreSQL (chats, users, spend log) — database
- Vendor model API — inference server
- Closed frontier model (GPT-5 / Claude / Gemini) — model
Connections
- Employees (office network) to Assistant application (Open WebUI + LiteLLM gateway) — HTTPS (confidential data)
- Assistant application (Open WebUI + LiteLLM gateway) to Existing identity provider (OIDC) — OIDC sign-in (personal data)
- Assistant application (Open WebUI + LiteLLM gateway) to Retrieval layer — question + user groups (confidential data)
- Retrieval layer to PostgreSQL + pgvector (embeddings) — embedding search (confidential data)
- Retrieval layer to PostgreSQL (chats, users, spend log) — documents + permissions (confidential data)
- Assistant application (Open WebUI + LiteLLM gateway) to PostgreSQL (chats, users, spend log) — chats, users, settings (personal data)
- Retrieval layer to Vendor model API — prompt + retrieved passages (confidential data)
- Vendor model API to Closed frontier model (GPT-5 / Claude / Gemini) — loaded weights
External data transfer · YES
- confidential content leaves your control on the Retrieval layer → Vendor model API link.
- The application, retrieval, identity and logs stay on your network; only the model call crosses to the vendor. The prompt and every retrieved passage go with it — that is the transfer to govern by contract.
- Changing vendor is a gateway configuration change, not an application rewrite: the closed model is the one component you do not hold.
03Suitable for
- Organisation size
- 10–5000 employees
- Data classes
- confidential, personal
- Constraints
- a team that can build and run a small application, or an implementation partner who will; a paid business account with the model vendor, not a personal key; agreement that prompts and retrieved passages may leave the network under contract
- Industries
- Technology, Professional services, Financial services, Retail, Other
- Jurisdictions
- any
04Hardware
No hardware profile was sized for this answer.
Indicative costUSD · one-off plus monthly
- Software
- Open WebUI, LiteLLM and pgvector are open source and self-installed. What you pay the model vendor is metered and sits on the model line, not here.
- US$0
- Model usage
- Not estimated here: priced per token — see the cost section, which multiplies a fetched price by the usage band read from your brief. Nothing in this seed asserts a price.
- Not estimated
- Application hosting and database
- Not estimated: a small always-on container and a managed or self-run PostgreSQL, priced per provider and region. No GPU is bought — the vendor runs the model.
- Not estimated
- Implementation (5–14 FDE-days)
- 5–14 FDE-days at US$760–1940 per day, converted from the HK$6,000–15,000 band at the HKMA Linked Exchange Rate band of HK$7.75–7.85 to one US dollar. One-off; excludes internal staff time.
- US$3,800 – US$27,160
- The model line is the one that grows with use; it is left to the cost section to compute from a fetched price and the usage band, never asserted here.
- Implementation covers the application, the gateway, retrieval over an initial corpus, SSO and an evaluation pass; it excludes the metered model bill entirely.
- Assumes an identity provider is already in place.
05Difficulty
3 / 5
A project week with Linux, Docker and GPU experience
06Skills
- API integrationapi-integration
- development
- Identity and SSOidentity-sso
- security
- LLM inferencellm-inference
- ml
- PostgreSQLpostgresql
- data
- Prompt engineeringprompt-engineering
- ml
- Retrieval-augmented generationrag
- ml
- Security hardeningsecurity-hardening
- security
07Deployment steps
Commands are copied from each project’s own documentation, and the page they came from is linked under the step. 0 of 7 steps currently open an evidence record. The rest are linked to their source; §10 says which of those documents were fetched and which were fetched without their anchor being found — two different states, named differently there.
- 01
Stand up the application shell
AssessmentStart from Open WebUI rather than a blank repository: it brings the chat interface, role-based access control and the conversation store, and points at any OpenAI-compatible endpoint. Run it in a container on your own infrastructure so the interface, the logs and the history are inside your boundary even though the model is not.
docker run -d -p 3000:8080 -v open-webui:/app/backend/data --name open-webui ghcr.io/open-webui/open-webui:main - 02
Put a LiteLLM gateway in front of the vendor keyversion-sensitive
AssessmentDo not let the application hold the raw vendor key. LiteLLM "brings up the gateway on port 4000 and a Postgres database that stores your models, keys, and spend logs"; point Open WebUI at the gateway, put the vendor key only in the gateway, and issue a virtual key per team so usage is attributable and one revocation does not disturb the others.
curl -sSL https://docs.litellm.ai/docker-compose.yml | docker compose -f - up -d - 03
Connect the closed model, and read its default data terms firstversion-sensitive
AssessmentChoosing the vendor is choosing the model. Before real content flows, read the commercial data terms: Anthropic states that "by default, we will not use your inputs or outputs from our commercial products" to train, and OpenAI’s enterprise page describes commitments that give you "ownership and control over your business data". A published page is where the contract starts, not a substitute for it — record which plan and endpoint the wording applies to.
- 04
Add retrieval with pgvector, and treat it as the sensitive part
AssessmentEnable pgvector in the database and index the corpus behind the assistant. pgvector’s own instruction is to "enable the extension (do this once in each database where you want to use it)". Remember what retrieval does to the request: it attaches internal passages to the prompt, so the most confidential content in a call is usually the part your own system added, not the user’s question.
CREATE EXTENSION vector;run once in the database that stores embeddings
- 05
Wire sign-in to your identity provider
AssessmentConfigure OIDC before the pilot so nobody has a local password and leavers lose access with their directory account. Open WebUI states that "any authentication provider that supports OIDC can be configured", so the assistant joins the estate rather than becoming a second directory to maintain.
- 06
Verify the data-handling questions against the vendor’s own pagesversion-sensitive
AssessmentFor the vendor and endpoint you will actually call, confirm: the data processing agreement covers the API and not only the consumer product; whether a zero-data-retention or no-logging mode exists on your account; the default retention period and what triggers human review; the region the request is served from; and the supported-countries page. The no-training defaults differ in wording by vendor — Azure states prompts and completions "are NOT used to train any generative AI foundation models without your permission or instruction" — so verify the exact commitment rather than assuming parity.
- 07
Set a spend cap, a logging decision and an evaluation set before launch
AssessmentPut a budget alert and a per-team spend limit on the gateway from the first week — a metered model bill grows with every user and every retrieved passage. Decide deliberately whether the gateway logs full prompts and completions, because those logs then hold the same confidential content as the source documents. Assemble a set of real questions with agreed answers and run it before launch and after every model or prompt change.
08Compliance considerations
Structured issue-spotting to support your own review — not legal advice. Verify against the cited primary sources and your counsel.
Applies everywhere
Prompt leakage · Confidentialityhigh
The supplier sees the whole prompt, including the passages retrieval attached — usually the most sensitive part. Decide what may be indexed for retrieval, and keep documents under a duty of confidence out of the corpus unless the contract and consent allow it.
Data processing agreement · Subprocessors · Vendor jurisdictionhigh
You need a data processing agreement that covers the API, the current subprocessor list, and the vendor’s supported-countries page — the last decides whether you may use the service at all from where you operate.
Model training · Retentionhigh
Verify the no-training default and the retention period for the plan and endpoint you buy. Anthropic states it does not use commercial inputs or outputs to train by default; Azure states prompts and completions are not used to train foundation models without your permission. Confirm whether a zero-data-retention mode is available for your account.
Cross-border transfers · Data residencymedium
Establish where the request is processed, not only where your database sits. A closed model’s region is the vendor’s to state; check whether it is a commitment or a routing preference before promising residency to anyone.
Logging · Auditabilitymedium
The gateway can log full prompts and completions. Decide whether to, apply the source documents’ retention rules to those logs if you do, and keep the per-key attribution so "who sent that prompt" has an answer.
09Alternatives
The same model inside your own cloud account
Where the same closed model is offered by your hyperscaler, calling it there keeps the request on your own network and under one existing agreement. The application does not change; only the tenancy of the model does.
- — The call stays inside your cloud boundary and existing DPA
- — You are limited to the models that cloud actually offers in your region
- — A cloud engineering job — private endpoints, quotas — replaces a single API key
Self-hosted, if prompts may not leave the network
Serve an open-weight model on your own GPU and no prompt reaches a vendor. The interface and retrieval layer are the same; the model is weaker and the operations are yours.
- — No vendor sees the prompt or the retrieved passages
- — A weaker model and a GPU to size, patch and pay for
- Self-hostedPrivate company knowledge base (self-hosted RAG)Open WebUI as the employee interface, vLLM serving a Qwen2.5-14B-Instruct model on a single 24 GB GPU, PostgreSQL with pgvector for chats and embeddings, and OIDC single sign-on — all in Docker on one server in your office or colocation rack. Ollama replaces vLLM for teams under about 20 users; a 48 GB GPU lets you run a 32B model for better answers.
- Private cloudAssistant on Amazon BedrockA model served through Amazon Bedrock, Bedrock Knowledge Bases for retrieval over your content (with OpenSearch Serverless if you manage the vector store yourself), a web application you build, IAM Identity Center for sign-in, and a VPC with PrivateLink so the call stays on your network.
10Evidence
Not yet in the ledger
not yet fetched
not yet fetched
not yet fetched
- OpenAI — Enterprise privacy
Vendor page
not yet fetched
not yet fetched
not yet fetched
not yet fetched
11Community
Deployed this stack, or hit something this page does not cover? Corrections, sources and implementation reports are what keep a recipe worth reading.
Improve this page
Sign in to contribute
From the field
0 deployments · 0 questions
Nobody has reported deploying this here yet, and no question has been opened against this page. Both appear once a reviewer accepts them.
12Hire an FDE
If you would rather not build it, we can introduce a forward-deployed engineer who has deployed this stack before. The enquiry form starts from this recipe.