本页还没有译文
本页 78 段还没译成简体中文,下面显示的是英文原文。Model providers
还没翻译译自英文(docs.langchain.com)本页 78 段都还没译
Deep Agents Code supports any chat model provider compatible with LangChain, 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.
Quickstart
Deep Agents Code integrates automatically with the following model providers: no extra configuration needed beyond installing the relevant provider package.
-
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 withdcode --install:/install groqdcode --install groqRun
/installwith no argument to list the valid extras. To preinstall extras during the initial CLI install, setDEEPAGENTS_CODE_EXTRAS:curl -LsSf https://langch.in/dcode | DEEPAGENTS_CODE_EXTRAS="baseten,groq" bash -
Set credentials
Add an API key for your provider with the
/authcredential manager:/auth/authshows a list of available providers and stores credentials for reuse across sessions.For non-interactive runs, CI/CD, or anywhere a TUI is not available, store the same key from the shell with
dcode auth setor set the provider's environment variable instead. See Provider credentials for the full key resolution order, theDEEPAGENTS_CODE_prefix for scoping a key to Deep Agents Code, and the Provider reference for each provider's environment variable.To configure model parameters, see Model parameters.
Provider reference
Using a provider not listed here? See 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 | OPENAI_API_KEY | ✅ |
| OpenAI (Codex) | langchain-openai | None; sign in with ChatGPT | ✅ |
| Azure OpenAI | langchain-openai | AZURE_OPENAI_API_KEY | ✅ |
| Anthropic | langchain-anthropic | ANTHROPIC_API_KEY | ✅ |
| Google Gemini API | langchain-google-genai | GOOGLE_API_KEY | ✅ |
| Gemini Enterprise Agent Platform | langchain-google-genai | GOOGLE_CLOUD_PROJECT | ✅ |
| Gemini Enterprise Agent Platform (Anthropic) | langchain-google-vertexai | GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION | ✅ |
| Baseten | langchain-baseten | BASETEN_API_KEY | ✅ |
| AWS Bedrock | langchain-aws | AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY | ✅ |
| AWS Bedrock Converse | langchain-aws | AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY | ✅ |
| Hugging Face | langchain-huggingface | HUGGINGFACEHUB_API_TOKEN | ✅ |
| Ollama | langchain-ollama | OLLAMA_API_KEY (cloud only; optional) | ❌ |
| Groq | langchain-groq | GROQ_API_KEY | ✅ |
| Cohere | langchain-cohere | COHERE_API_KEY | ❌ |
| Fireworks | langchain-fireworks | FIREWORKS_API_KEY | ✅ |
| Together | langchain-together | TOGETHER_API_KEY | ❌ |
| Meta | langchain-meta | MODEL_API_KEY | ✅ |
| Mistral AI | langchain-mistralai | MISTRAL_API_KEY | ✅ |
| DeepSeek | langchain-deepseek | DEEPSEEK_API_KEY | ✅ |
| IBM (watsonx.ai) | langchain-ibm | WATSONX_APIKEY | ❌ |
| Nvidia | langchain-nvidia-ai-endpoints | NVIDIA_API_KEY | ✅ |
| xAI | langchain-xai | XAI_API_KEY | ✅ |
| Perplexity | langchain-perplexity | PERPLEXITY_API_KEY (or PPLX_API_KEY) | ✅ |
| OpenRouter | langchain-openrouter | OPENROUTER_API_KEY | ✅ |
| LiteLLM | langchain-litellm | Per-provider (see docs) | ❌ |
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 for details.
Tip
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.
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.
-
Start the sign-in
Run
/authin any session and selectopenai_codex. Because ChatGPT signs you in through your browser, this starts a browser sign-in instead of asking for an API key. -
Authorize in your browser
Deep Agents Code opens your browser to the ChatGPT sign-in page. If it cannot 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.
-
Select a Codex model
Once signed in, the Codex models appear in the
/modelswitcher under theopenai_codexprovider. Switch to one directly with its spec:/model openai_codex:gpt-5.5
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
Some provider-specific account types or key scopes may not work for API access. If a provider appears configured in /auth but requests still fail, verify that the account plan and API-key permissions match the provider's API requirements.
Model routers and proxies
Model routers like OpenRouter and LiteLLM 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 | openrouter:<model> (built-in, see Provider reference) |
| LiteLLM | langchain-litellm | litellm:<model> (built-in, see Provider reference) |
OpenRouter is a built-in provider—install the extra and use it directly:
/install openrouterdcode --install openrouterLiteLLM is also a built-in provider:
/install litellmdcode --install litellmSwitch models
To switch models in Deep Agents Code, either:
-
Use the interactive model switcher with the
/modelcommand.Note
Not all models appear here. If yours is missing, pass the model name directly (e.g.
/model gpt-5.5) or add it toconfig.toml. -
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. -
Specify the model at launch via
--model, e.g.dcode --model openai:gpt-5.5
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.
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:
-
Install Ollama and pull a model, for example:
ollama pull qwen3:4b -
Install the Ollama extra:
/install ollamadcode --install ollama -
Select the model:
/modeldcode --model ollama:qwen3:4bUse 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:
-
Get a free API key at console.groq.com.
-
Install the Groq extra:
/install groqdcode --install groq -
Select a model:
/modelGROQ_API_KEY="your-api-key" dcode --model groq:openai/gpt-oss-120bUse 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:
/install fireworks
/modeldcode --install fireworks
FIREWORKS_API_KEY="your-api-key" dcode --model fireworks:accounts/fireworks/models/deepseek-v4-proUse 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:
/install baseten
/modeldcode --install baseten
BASETEN_API_KEY="your-api-key" dcode --model baseten:moonshotai/Kimi-K2.7-CodeUse 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:
curl -LsSf https://langch.in/dcode | DEEPAGENTS_CODE_EXTRAS="fireworks" bashYou 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.
Together, OpenRouter, and Hugging Face (langchain-huggingface) are other options for cloud-hosted open weights. See the 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 pressCtrl+Sto pin it as the default. PressingCtrl+Sagain 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].defaultin~/.deepagents/config.toml(see Configuration). -
From the shell:
dcode --default-model anthropic:claude-opus-4-8
To view the current default:
dcode --default-modelTo clear the default:
-
From the shell:
dcode --clear-default-model -
Via command:
/model --default --clear -
Via model selector: Press
Ctrl+Son 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):
-
One-off at launch with
--model-params. JSON string, session-only:# 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}' -
Mid-session via
/model --model-params. Same JSON syntax—swaps params (and optionally the model) without restarting:/model --model-params '{"temperature": 0.7}' anthropic:claude-opus-4-8 /model --model-params '{"num_ctx": 16384}' # opens selector, applies params to choice -
Persistent in
config.toml. Provider-level defaults (with optional per-model sub-tables) that apply on every launch:[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 for full semantics). --model-params cannot be combined with --default.
For retry counts, prefer --max-retries or the top-level [retries] config.
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, ChatOpenAI, ChatOllama. Unknown kwargs are forwarded to the upstream API request, so newly released parameters work without a CLI update.
Note
Do not put credentials (api_key) in params—use api_key_env to point at an environment variable instead.
To override fields on the model's runtime profile (max_input_tokens, tool_calling, capability flags)—distinct from constructor params—see Profile overrides.
Advanced configuration
For detailed configuration of provider params, profile overrides, custom base URLs, compatible APIs, arbitrary providers, and lifecycle hooks, see Config file and Hooks.