Skip to Content
Welcome to the new DocsGPT docs!
GuidesοΈπŸ€– How to use different LLM's

Setting Up Local Language Models for Your App

Setting up local language models for your app can significantly enhance its capabilities, enabling it to understand and generate text in multiple languages without relying on external APIs. By integrating local language models, you can improve privacy, reduce latency, and ensure continuous functionality even in offline environments. Here’s a comprehensive guide on how to set up local language models for your application:

Steps:

For cloud version LLM change:

Step 1

Visit the chat screen and you will be to see the default LLM selected.

Step 2

Click on it and you will get a drop down of various LLM’s available to choose.

Step 3

Choose the LLM of your choice.

Video Demo

prompts

For Open source llm change:

Step 1

For open source version please edit LLM_PROVIDER, LLM_NAME and others in the .env file. Refer to βš™οΈ App Configuration for more information.

Step 2

Visit ☁️ Cloud Providers for the updated list of online models. Make sure you have the right API_KEY and correct LLM_PROVIDER. For self-hosted please visit πŸ–₯️ Local Inference.

Fallback LLM

DocsGPT can automatically switch to a fallback LLM when the primary model fails, including mid-stream. This works with both streaming and non-streaming requests.

Fallback order:

  1. Per-agent backup models (other models configured on the same agent)
  2. Global fallback (FALLBACK_LLM_* env vars below)
  3. Error returned if all fail
SettingDescriptionDefault
FALLBACK_LLM_PROVIDERProvider name (e.g., openai, anthropic, google)β€”
FALLBACK_LLM_NAMEModel name (e.g., gpt-4o, claude-sonnet-4-20250514)β€”
FALLBACK_LLM_API_KEYAPI key for the fallback providerFalls back to API_KEY

All three (FALLBACK_LLM_PROVIDER, FALLBACK_LLM_NAME, and an API key) must resolve for the global fallback to activate.

FALLBACK_LLM_PROVIDER=anthropic FALLBACK_LLM_NAME=claude-sonnet-4-20250514 FALLBACK_LLM_API_KEY=sk-ant-your-anthropic-key

For maximum resilience, use a fallback provider from a different cloud than your primary. Each agent can also have multiple models configured β€” the other models are tried first before the global fallback.