Skip to Content
Models๐Ÿงฉ Custom 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. 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.

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.

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,
  • 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.

To edit or delete a model, open the menu on its card in Settings โ†’ Custom Models. A model disabled through the API ("enabled": false) shows a Disabled badge and is hidden from the pickers.

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 per-user salt 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"). A token with chat:run can call it too.
GET /api/user/modelsLists the callerโ€™s custom models.
POST /api/user/modelsAdds a model.
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.
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.
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" } }'

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.