> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Model providers

> Configure any LangChain-compatible model provider for Deep Agents Code

Deep Agents Code supports any [chat model provider compatible with LangChain](/oss/python/integrations/chat), unlocking use for virtually any LLM that supports tool calling. Any service that exposes an OpenAI-compatible or Anthropic-compatible API also works out of the box—see [Compatible APIs](/oss/python/deepagents/code/configuration#compatible-apis).

## Quickstart

Deep Agents Code integrates automatically with the [following model providers](#provider-reference): no extra configuration needed beyond installing the relevant provider package.

1. **Install provider packages**

   Each model provider requires its corresponding LangChain integration package. These ship as optional extras to keep the application lightweight. OpenAI, Anthropic, and Gemini are included by default. Install any other extra from within a session with `/install`, or from the shell with `dcode --install`:

   <CodeGroup>
     ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     /install groq
     ```

     ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     dcode --install groq
     ```
   </CodeGroup>

   Run `/install` with no argument to list the valid extras. To preinstall extras during the initial CLI install, set `DEEPAGENTS_CODE_EXTRAS`:

   ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
   DEEPAGENTS_CODE_EXTRAS="baseten,groq" curl -LsSf https://langch.in/dcode | bash
   ```

2. **Set credentials**

   Add an API key for your provider with the [`/auth`](/oss/python/deepagents/code/configuration#use-%2Fauth-recommended) credential manager:

   ```txt theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
   /auth
   ```

   For non-interactive runs, CI/CD, or anywhere a TUI isn't available, store the same key from the shell with [`dcode auth set`](/oss/python/deepagents/code/configuration#manage-credentials-from-the-shell-dcode-auth) or set the provider's environment variable instead. See [Provider credentials](/oss/python/deepagents/code/configuration#provider-credentials) for the full key resolution order, the [`DEEPAGENTS_CODE_` prefix](/oss/python/deepagents/code/configuration#deepagents_code_-prefix) for scoping a key to Deep Agents Code, and the [Provider reference](#provider-reference) for each provider's environment variable.

   To configure model parameters, see [Model parameters](#model-parameters).

## Provider reference

Using a provider not listed here? See [Arbitrary providers](/oss/python/deepagents/code/configuration#arbitrary-providers): any LangChain-compatible provider can be used in Deep Agents Code with additional setup.

| Provider             | Package                                                                                    | Credential env var                                   | Model profiles |
| -------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------- | -------------- |
| OpenAI               | [`langchain-openai`](/oss/python/integrations/chat/openai)                                 | `OPENAI_API_KEY`                                     | ✅              |
| OpenAI (Codex)       | [`langchain-openai`](/oss/python/integrations/chat/openai)                                 | None — [sign in with ChatGPT](#sign-in-with-chatgpt) | ✅              |
| Azure OpenAI         | [`langchain-openai`](/oss/python/integrations/chat/azure_chat_openai)                      | `AZURE_OPENAI_API_KEY`                               | ✅              |
| Anthropic            | [`langchain-anthropic`](/oss/python/integrations/chat/anthropic)                           | `ANTHROPIC_API_KEY`                                  | ✅              |
| Google Gemini API    | [`langchain-google-genai`](/oss/python/integrations/chat/google_generative_ai)             | `GOOGLE_API_KEY`                                     | ✅              |
| Google Vertex AI     | [`langchain-google-genai`](/oss/python/integrations/chat/google_generative_ai#credentials) | `GOOGLE_CLOUD_PROJECT`                               | ✅              |
| Baseten              | [`langchain-baseten`](https://github.com/basetenlabs/langchain-baseten)                    | `BASETEN_API_KEY`                                    | ✅              |
| AWS Bedrock          | [`langchain-aws`](/oss/python/integrations/chat/bedrock)                                   | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`         | ✅              |
| AWS Bedrock Converse | [`langchain-aws`](/oss/python/integrations/chat/bedrock)                                   | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`         | ✅              |
| Hugging Face         | [`langchain-huggingface`](/oss/python/integrations/chat/huggingface)                       | `HUGGINGFACEHUB_API_TOKEN`                           | ✅              |
| Ollama               | [`langchain-ollama`](/oss/python/integrations/chat/ollama)                                 | `OLLAMA_API_KEY` (cloud only; optional)              | ❌              |
| Groq                 | [`langchain-groq`](/oss/python/integrations/chat/groq)                                     | `GROQ_API_KEY`                                       | ✅              |
| Cohere               | [`langchain-cohere`](/oss/python/integrations/chat/cohere)                                 | `COHERE_API_KEY`                                     | ❌              |
| Fireworks            | [`langchain-fireworks`](/oss/python/integrations/chat/fireworks)                           | `FIREWORKS_API_KEY`                                  | ✅              |
| Together             | [`langchain-together`](/oss/python/integrations/chat/together)                             | `TOGETHER_API_KEY`                                   | ❌              |
| Mistral AI           | [`langchain-mistralai`](/oss/python/integrations/chat/mistralai)                           | `MISTRAL_API_KEY`                                    | ✅              |
| DeepSeek             | [`langchain-deepseek`](/oss/python/integrations/chat/deepseek)                             | `DEEPSEEK_API_KEY`                                   | ✅              |
| IBM (watsonx.ai)     | [`langchain-ibm`](/oss/python/integrations/chat/ibm_watsonx)                               | `WATSONX_APIKEY`                                     | ❌              |
| Nvidia               | [`langchain-nvidia-ai-endpoints`](/oss/python/integrations/chat/nvidia_ai_endpoints)       | `NVIDIA_API_KEY`                                     | ✅              |
| xAI                  | [`langchain-xai`](/oss/python/integrations/chat/xai)                                       | `XAI_API_KEY`                                        | ✅              |
| Perplexity           | [`langchain-perplexity`](/oss/python/integrations/chat/perplexity)                         | `PERPLEXITY_API_KEY` (or `PPLX_API_KEY`)             | ✅              |
| OpenRouter           | [`langchain-openrouter`](/oss/python/integrations/chat/openrouter)                         | `OPENROUTER_API_KEY`                                 | ✅              |
| LiteLLM              | [`langchain-litellm`](/oss/python/integrations/chat/litellm)                               | Per-provider (see [docs](https://docs.litellm.ai/))  | ❌              |

<Tip>
  You can scope any credential to Deep Agents Code by adding a `DEEPAGENTS_CODE_` prefix. For example, `DEEPAGENTS_CODE_OPENAI_API_KEY` takes priority over `OPENAI_API_KEY` within Deep Agents Code without affecting other tools. See [`DEEPAGENTS_CODE_` prefix](/oss/python/deepagents/code/configuration#deepagents_code_-prefix) for details.
</Tip>

<Tip>
  [Model profiles](/oss/python/langchain/models#model-profiles) provide model metadata used by the interactive `/model` switcher. If a model is missing from the switcher, pass the model name directly or add it via `config.toml`.
</Tip>

### Sign in with ChatGPT

The `openai_codex` provider lets you use OpenAI's Codex models with your paid **ChatGPT** subscription instead of an `OPENAI_API_KEY`. You sign in with your ChatGPT account, and it shows up as its own provider in both `/auth` and the `/model` switcher, separate from the API-key-based `openai` provider.

<Steps>
  <Step title="Start the sign-in">
    Run `/auth` in any session and select **`openai_codex`**. Because ChatGPT signs you in through your browser, this starts a browser sign-in instead of asking for an API key.
  </Step>

  <Step title="Authorize in your browser">
    Deep Agents Code opens your browser to the ChatGPT sign-in page. If it can't open a browser (for example, over SSH), it also shows the sign-in URL on screen so you can copy it to a browser on another device.
  </Step>

  <Step title="Select a Codex model">
    Once signed in, the Codex models appear in the `/model` switcher under the `openai_codex` provider. Switch to one directly with its spec:

    ```txt theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    /model openai_codex:gpt-5.5
    ```
  </Step>
</Steps>

Your sign-in persists across sessions. To check your status or sign out, run `/auth`, select `openai_codex`, and choose to re-authenticate or sign out.

<Note>
  `openai_codex` is separate from `openai`. To use OpenAI models with a standard API key instead, use the regular `openai` provider (e.g. `/model openai:gpt-5.5`).
</Note>

### Model routers and proxies

Model routers like [OpenRouter](https://openrouter.ai/) and [LiteLLM](https://docs.litellm.ai/) provide access to models from multiple providers through a single endpoint.

Use the dedicated integration packages for these services:

| Router     | Package                                                            | Config                                                                         |
| ---------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| OpenRouter | [`langchain-openrouter`](/oss/python/integrations/chat/openrouter) | `openrouter:<model>` (built-in, see [Provider reference](#provider-reference)) |
| LiteLLM    | [`langchain-litellm`](/oss/python/integrations/chat/litellm)       | `litellm:<model>` (built-in, see [Provider reference](#provider-reference))    |

**OpenRouter** is a built-in provider—install the extra and use it directly:

<CodeGroup>
  ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  /install openrouter
  ```

  ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  dcode --install openrouter
  ```
</CodeGroup>

**LiteLLM** is also a built-in provider:

<CodeGroup>
  ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  /install litellm
  ```

  ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  dcode --install litellm
  ```
</CodeGroup>

## Switch models

To switch models in Deep Agents Code, either:

1. **Use the interactive model switcher** with the `/model` command.

   <Note>
     Not all models appear here. If yours is missing, pass the model name directly (e.g. `/model gpt-5.5`) or add it to `config.toml`.
   </Note>
2. **Specify a model name directly** as an argument, e.g. `/model gpt-5.5`. You can use any model supported by the chosen provider, regardless of whether it appears in the list from option 1. The model name will be passed to the API request.
3. **Specify the model at launch** via `--model`, e.g.

   ```txt theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
   dcode --model openai:gpt-5.5
   ```

<Accordion title="Model resolution order" icon="list-numbers">
  When Deep Agents Code launches, it resolves which model to use in the following order:

  1. **`--model` flag** always wins when provided.
  2. **`[models].default`** in `~/.deepagents/config.toml`—the user's intentional long-term preference.
  3. **`[models].recent`** in `~/.deepagents/config.toml`—the last model switched to via `/model`. Written automatically; never overwrites `[models].default`.
  4. **Environment auto-detection**: falls back to the first available startup credential, checked in order: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `GOOGLE_CLOUD_PROJECT` (Vertex AI).

  This startup fallback intentionally checks only those four credentials. Other supported providers (for example, Groq) are still available via `--model`, `/model`, and saved defaults (`[models].default` / `[models].recent`).
</Accordion>

### Which models appear in the switcher

The `/model` selector dynamically builds its list from installed provider packages. Expand below for the full criteria and troubleshooting.

<Accordion title="How the switcher builds its model list" icon="list-search">
  The interactive `/model` selector builds its list from installed provider packages and models configured in `config.toml`.

  A model appears when:

  1. The provider package is installed.
  2. The model is available from the provider package, a local provider, or your `config.toml`.
  3. The model profile does not mark text input or output as unsupported.

  If a model is missing, use `/model <provider>:<model>` directly or add it to [`[models.providers.<name>].models`](/oss/python/deepagents/code/configuration#adding-models-to-the-interactive-switcher).

  <Tip>
    Credential status does **not** affect whether a model is listed. You can still select a model with missing credentials. The provider reports an authentication error at request time.
  </Tip>
</Accordion>

### Open weights models

If you want to use an open weights model, there are two common paths depending on whether you prefer local or cloud-hosted inference.

**Local inference with Ollama** is the easiest way to get started for free, with no API key required:

1. [Install Ollama](https://ollama.com/) and pull a model, for example:

   ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
   ollama pull qwen3:4b
   ```

2. Install the Ollama extra:

   <CodeGroup>
     ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     /install ollama
     ```

     ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     dcode --install ollama
     ```
   </CodeGroup>

3. Select the model:

   <CodeGroup>
     ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     /model
     ```

     ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     dcode --model ollama:qwen3:4b
     ```
   </CodeGroup>

   Use the interactive switcher, or pass the model directly with `/model ollama:qwen3:4b`.

**Cloud-hosted open weights via Groq** gives you fast inference without running anything locally:

1. Get a free API key at [console.groq.com](https://console.groq.com/).

2. Install the Groq extra:

   <CodeGroup>
     ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     /install groq
     ```

     ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     dcode --install groq
     ```
   </CodeGroup>

3. Select a model:

   <CodeGroup>
     ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     /model
     ```

     ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     GROQ_API_KEY="your-api-key" dcode --model groq:openai/gpt-oss-120b
     ```
   </CodeGroup>

   Use the interactive switcher, or pass the model directly with `/model groq:openai/gpt-oss-120b`.

**Fireworks** is another popular cloud provider for open weights models:

<CodeGroup>
  ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  /install fireworks
  /model
  ```

  ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  dcode --install fireworks
  FIREWORKS_API_KEY="your-api-key" dcode --model fireworks:accounts/fireworks/models/deepseek-v4-pro
  ```
</CodeGroup>

Use the interactive switcher, or pass the model directly with `/model fireworks:accounts/fireworks/models/deepseek-v4-pro`.

**Baseten** is another cloud provider for open weights models:

<CodeGroup>
  ```txt In session theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  /install baseten
  /model
  ```

  ```bash Shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  dcode --install baseten
  BASETEN_API_KEY="your-api-key" dcode --model baseten:moonshotai/Kimi-K2.7-Code
  ```
</CodeGroup>

Use the interactive switcher, or pass the model directly with `/model baseten:moonshotai/Kimi-K2.7-Code`.

<Tip>
  If you want a provider preinstalled at the same time as the CLI itself, use `DEEPAGENTS_CODE_EXTRAS` during the initial install:

  ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  DEEPAGENTS_CODE_EXTRAS="fireworks" curl -LsSf https://langch.in/dcode | bash
  ```

  You can combine multiple providers: `DEEPAGENTS_CODE_EXTRAS="groq,fireworks,ollama"`. If Deep Agents Code is already installed, use `/install <extra>` in a session or `dcode --install <extra>` from the shell instead.
</Tip>

**Together**, **OpenRouter**, and **Hugging Face** (`langchain-huggingface`) are other options for cloud-hosted open weights. See the [Provider reference](#provider-reference) for credentials and package names.

### Set a default model

You can set a persistent default model that applies to all future CLI launches:

* **Via model selector:** Open `/model`, navigate to the desired model, and press `Ctrl+S` to pin it as the default. Pressing `Ctrl+S` again on the current default clears it.
* **Via command:** `/model --default provider:model` (e.g., `/model --default anthropic:claude-opus-4-8`)
* **Via config file:** Set `[models].default` in `~/.deepagents/config.toml` (see [Configuration](/oss/python/deepagents/code/configuration)).
* **From the shell:**

  ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  dcode --default-model anthropic:claude-opus-4-8
  ```

To view the current default:

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
dcode --default-model
```

To clear the default:

* **From the shell:**

  ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  dcode --clear-default-model
  ```

* **Via command:** `/model --default --clear`

* **Via model selector:** Press `Ctrl+S` on the currently pinned default model.

Without a default, Deep Agents Code uses the most recently used model.

### Model parameters

Pass extra constructor kwargs to the model—sampling controls, reasoning/thinking budgets, context window sizes, request timeouts, and anything else the underlying chat-model class accepts. Three places to set them, in priority order (highest first):

1. **One-off at launch with `--model-params`.** JSON string, session-only:

   ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
   # OpenAI reasoning effort
   dcode --model openai:gpt-5.5 --model-params '{"reasoning": {"effort": "high"}}'

   # Anthropic extended thinking
   dcode --model anthropic:claude-opus-4-8 --model-params '{"thinking": {"type": "enabled", "budget_tokens": 10000}, "max_tokens": 16000}'
   ```

2. **Mid-session via `/model --model-params`.** Same JSON syntax—swaps params (and optionally the model) without restarting:

   ```txt theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
   /model --model-params '{"temperature": 0.7}' anthropic:claude-opus-4-8
   /model --model-params '{"num_ctx": 16384}'           # opens selector, applies params to choice
   ```

3. **Persistent in `config.toml`.** Provider-level defaults (with optional per-model sub-tables) that apply on every launch:

   ```toml theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
   [models.providers.anthropic.params]
   thinking = { type = "enabled", budget_tokens = 10000 }
   max_tokens = 16000

   [models.providers.openai.params]
   reasoning = { effort = "high", summary = "auto" }
   output_version = "responses/v1"

   [models.providers.ollama.params]
   num_ctx = 16384
   temperature = 0

   # Per-model override—wins over provider-level keys
   [models.providers.ollama.params."qwen3:4b"]
   temperature = 0.5
   ```

CLI flags override config-file `params` and are session-only (mid-session changes are not persisted). Per-model sub-tables in `config.toml` override provider-level keys (shallow merge—see [Model constructor params](/oss/python/deepagents/code/configuration#model-constructor-params) for full semantics). `--model-params` cannot be combined with `--default`.

For retry counts, prefer `--max-retries` or the top-level [`[retries]` config](/oss/python/deepagents/code/configuration#retries).

<Tip>
  Any kwarg accepted by the underlying chat-model constructor is valid. Refer to the provider's reference docs for the full list—e.g. [`ChatAnthropic`](https://reference.langchain.com/python/langchain-anthropic/langchain_anthropic/chat_models/ChatAnthropic), [`ChatOpenAI`](https://reference.langchain.com/python/langchain-openai/langchain_openai/chat_models/base/ChatOpenAI), [`ChatOllama`](https://reference.langchain.com/python/langchain-ollama/langchain_ollama/chat_models/ChatOllama). Unknown kwargs are forwarded to the upstream API request, so newly released parameters work without a CLI update.
</Tip>

<Note>
  Don't put credentials (`api_key`) in `params`—use [`api_key_env`](/oss/python/deepagents/code/configuration#provider-configuration) to point at an environment variable instead.
</Note>

To override fields on the model's runtime *profile* (`max_input_tokens`, `tool_calling`, capability flags)—distinct from constructor params—see [Profile overrides](/oss/python/deepagents/code/configuration#profile-overrides-advanced).

## Advanced configuration

For detailed configuration of provider params, profile overrides, custom base URLs, compatible APIs, arbitrary providers, and lifecycle hooks, see [Configuration](/oss/python/deepagents/code/configuration).

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/deepagents/code/providers.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
