← Back to PRs

#13650: feat(agents): support env var overrides for default provider and model

by xrehpicx open 2026-02-10 20:11 View on GitHub →
agents stale
This PR allows users to override the default model provider and model ID using environment variables. Currently, the defaults are hardcoded to Anthropic and Claude Opus. Users who don't have an Anthropic key currently encounter errors or have to manually configure an agent first. Changes: - Set DEFAULT_PROVIDER to process.env.OPENCLAW_DEFAULT_PROVIDER || "anthropic" - Set DEFAULT_MODEL to process.env.OPENCLAW_DEFAULT_MODEL || "claude-opus-4-6" This allows users to use other providers (e.g., OpenAI, Google) by simply setting these environment variables. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Adds environment variable overrides (`OPENCLAW_DEFAULT_PROVIDER` and `OPENCLAW_DEFAULT_MODEL`) for the default model provider and model ID in `src/agents/defaults.ts`. This allows users without Anthropic API keys to configure alternative providers (OpenAI, Google, etc.) via environment variables instead of manually editing configuration files. The change follows the existing `process.env.VAR || "default"` pattern used throughout the codebase and maintains backward compatibility with the hardcoded Anthropic/Claude Opus defaults. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The change is minimal (2 lines), follows established patterns used extensively in the codebase (`process.env` usage), maintains backward compatibility with existing defaults, and adds useful flexibility for users with different provider credentials. No breaking changes or logical issues detected. - No files require special attention <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs