Skip to Content
Docs
Models

Custom Models

Settings → Custom Models lets any signed-in user add a model from an OpenAI-compatible endpoint (Mistral, Together, a hosted vLLM, and so on) with their own API key. In Personal, the model is private to that user: it appears in their model pickers next to the models the operator configured, and nobody else sees it, except a team editor of one of their workflows (see below). In a team workspace, the page holds the team’s own models, which a team Admin adds for everyone in the team; see Team models.

Operators who want a model available to everyone configure it on the server instead, with a cloud provider key, OPENAI_BASE_URL, or a model YAML in MODELS_CONFIG_DIR.

Add a model

  1. Open Settings → Custom Models and click Add Model.

  2. Fill in the fields:

    FieldWhat to enter
    Display nameThe name shown in model pickers, for example My Mistral.
    Model IDThe model name the provider’s API expects, sent as-is, for example mistral-large-latest.
    DescriptionOptional.
    Base URLThe provider’s OpenAI-compatible base URL, including the version path, for example https://api.mistral.ai/v1. DocsGPT appends /chat/completions (or /responses). Must be a public address; see Public endpoints only.
    API keyThe key for that endpoint. Required: a model can’t be saved without one.
  3. Set the Capabilities so DocsGPT uses the model correctly:

    CapabilityDefaultMeaning
    ToolsonThe model supports function calling, so agents can give it tools.
    Structured outputonThe model supports JSON-schema responses.
    ImagesoffThe model accepts image attachments.
    Context window128000Tokens the model accepts, between 1,000 and 10,000,000. DocsGPT uses it to decide when to compress conversation history.
    API protocolChat CompletionsChat Completions (/chat/completions) or Responses (/responses). Most providers only offer Chat Completions.
    Reasoning effortProvider defaultFor reasoning models: none, minimal, low, medium, high or xhigh. Leave it at Provider default unless the model documents the parameter.
  4. Click Test connection, then Save.

Test connection sends a tiny request (hi, with a 1-token limit, or 16 for the Responses protocol) to the endpoint with the values currently in the form, before anything is saved, and shows Connection successful. or the provider’s error. It times out after 5 seconds and doesn’t follow redirects. When you edit a saved model, leave API key blank to test (and keep) the stored key. If you change the base URL to another host (a different scheme, host or port), enter the key again: the stored key is only sent to the host it was saved for, so the test and the save are refused without it.

Where the model appears

Enabled custom models are listed next to the operator’s models in:

  • the model picker when you start a chat without an agent,
  • the model selector in the agent builder and in workflow AI Agent nodes, where they are grouped under My Models (in a team, the team’s models under Team models),
  • the model lists in a source’s settings (the GraphRAG extraction model, for example).

An agent that uses your custom model keeps using it for everyone who can run the agent: team members you share it with and agent API key callers. Their requests go to your endpoint with your key. If you delete the model, or its key can no longer be decrypted, the agent falls back to the instance’s default model.

The same goes for a workflow AI Agent node set to your custom model: whoever runs the workflow agent, the node calls your endpoint with your key, and the usage counts toward the agent. A model set on a node is looked up in the workflow owner’s account, so:

  • If you delete the model, or its key can no longer be decrypted, the nodes set to it fail with Model ’…’ is not available until you pick another model for them. They don’t fall back to the default model. Disabling the model only hides it from the pickers; the nodes keep using it.
  • A team editor of your workflow picks a node’s model from your custom models, listed under Owner’s Models in place of their own. The list their browser gets carries each model’s name, provider, context window and whether it supports structured output, not its endpoint, key or other settings. The picker shows the name and provider. The context window feeds the workflow’s context-limit note, and the structured-output flag the node’s Advanced settings warning when the picked model can’t return structured output. An editor’s access token gets this list only with models:read. A node set to one of their own custom models can’t run, because you don’t have that model, so the save is refused.
  • A node without a model of its own runs on the agent’s model, looked up as for the agent itself.

To edit, disable or delete a model, open the ⋯ menu on its card in Settings → Custom Models. Disable hides the model from the pickers and gives its card a Disabled badge; Enable brings it back. Delete asks you to confirm and names the agents and workflows that use the model, so you know what falls back to the default model (or, for a workflow node, stops) as described above.

Team models

In a team workspace, Settings → Custom Models lists the team’s models, under “These models belong to the team. Your own models are in Personal.” A team model works like your own, with these differences:

  • Who adds it. Only the team’s Admins and Owner add, edit, test, enable or disable, and delete the team’s models. Each card says who added it.
  • Who sees it. Every member sees the team’s models, but only Admins and the Owner see a model’s base URL. Nobody sees its key.
  • Who uses it. Every member can pick it in a team chat, and Editors and up set it on the team’s agents and workflows. A team chat offers the instance’s models and the team’s, never your own; a team’s agents and workflows run only on the team’s custom models, and your personal agents never on a team’s.
  • Who pays. Whoever starts a run pays from their own allowance, as for any model. The provider bills the team’s key.
  • When the person who added it leaves, nothing pauses: the model keeps running on the key they entered. An Admin can replace the key.

While a team has custom models, it can’t be deleted. For moving agents that use a custom model, importing one into a team, and sharing a team agent that runs on one, see Team custom models.

Copy a model to a team

To bring one of your own models into a team without typing its key again, open the ⋯ menu on its card in Personal and choose Copy to a team. The item appears only when you’re an Admin or the Owner of a team. Pick the team, if you have several, and choose Copy: the team gets its own copy of the model with your API key, and your model stays as it is.

The copy belongs to the team and names you as the person who added it. From then on, every member’s use of it spends that key. If the team already has the model, the copy is refused (“The team already has this model.”). If your model’s key can’t be read any more, replace the key first.

Public endpoints only

The base URL must resolve to a public address. DocsGPT refuses localhost, loopback, private (RFC 1918), link-local, carrier-grade NAT, multicast and reserved addresses, both when you save the model and on every request, and pins each request to the address it checked. This stops users from turning the instance into a proxy to its internal network. See Outbound network access.

So a model running on the same machine or your LAN (a local Ollama, LM Studio or vLLM) can’t be added here. Configure it as the operator instead, with OPENAI_BASE_URL or a model YAML, which aren’t checked: see Local inference.

How the API key is stored

The API key is encrypted with ENCRYPTION_SECRET_KEY and a salt for its owner (the user, or the team for a team’s model) before it is written to the database, and the API never returns it. Set your own ENCRYPTION_SECRET_KEY before users add models; with the public default the keys are only as safe as that default (see Secrets to set before going live).

When the operator rotates the key, docsgpt connectors reencrypt rewrites custom-model keys along with connections and tool secrets. A model whose key neither the current nor the previous key opens is left out of the pickers until you edit it and enter the API key again.

API

The same operations are available over the API. With a personal access token, reading needs the models:read scope and every other call needs models:write.

Method and pathDoes
GET /api/modelsLists every model available to the caller, including their custom models ("source": "user"). In a team workspace, it lists the team’s enabled models instead ("source": "team", without base_url) and never the caller’s own. A token with chat:run can call it too.
GET /api/user/modelsLists the caller’s custom models. With owner=team, lists the models of the team the workspace header names.
POST /api/user/modelsAdds a model. With "owner": "team", adds it for the team the workspace header names (Admins and the Owner).
GET, PATCH, DELETE /api/user/models/<id>Reads, updates or deletes one model. In a PATCH, a missing or empty api_key keeps the stored key, unless base_url moves to another host (scheme, host or port): then api_key is required, and the update is refused with 400 api_key_required_for_new_host.
POST /api/user/models/testTests unsaved values (base_url, api_key, upstream_model_id, optional capabilities).
POST /api/user/models/<id>/testTests a saved model; any of base_url, api_key and upstream_model_id in the body override the stored values. A base_url on another host needs api_key too (400, code: api_key_required_for_new_host).
GET /api/user/models/<id>/usageThe agents and workflows of the model’s owner that use it: {"usage": {"agents": [{id, name}], "workflows": [{id, name}]}}.
POST /api/user/models/<id>/copyCopies one of your own models to a team you’re an Admin of: {"team_id": "..."}. Answers 201 with the team’s new model, or 409 model_already_in_team when the team has it.
curl -X POST https://your-docsgpt/api/user/models \
  -H "Authorization: Bearer dgpt_pat_..." \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "My Mistral",
    "upstream_model_id": "mistral-large-latest",
    "base_url": "https://api.mistral.ai/v1",
    "api_key": "YOUR_MISTRAL_KEY",
    "capabilities": {
      "supports_tools": true,
      "supports_structured_output": true,
      "attachments": [],
      "context_window": 128000,
      "api_flavor": "chat_completions"
    }
  }'

A team model’s id routes go by the model’s own team, whatever the workspace header says: a member reads it, and only the team’s Admins and Owner change, test or delete it (403 model_admin_required); anyone outside the team gets 404. Every model carries owner (personal or team), team_id, created_by and allowed_actions, and base_url only for those who may change it. A token reads the team’s models with models:read, but can’t add, change, test, copy or delete them: those answer 403 not_available_to_tokens. Deleting a team model returns the agents and workflows that used it under usage.

The response is the saved model without its key. Its id is what an agent’s default_model_id stores. The test endpoints answer 200 with {"ok": true} or {"ok": false, "error": "..."}, and 400 when the base URL is refused, the capabilities are invalid, or a saved model’s stored key can’t be decrypted.

There is no setting that turns Custom Models off: every signed-in user can add models of their own, and every team Admin can add models for the team.

Edit this page on GitHub

Last updated on

On this page