InternAgent can use OpenRouter as a first-class model provider for the main multi-agent discovery pipeline. OpenRouter uses an OpenAI-compatible API, so the same agent code can route requests to models from OpenAI, Anthropic, Google, and other providers through one endpoint.
Create an OpenRouter account, add credits, and create an API key from:
https://openrouter.ai/settings/keys
Copy the environment template and set your OpenRouter key:
cp .env.example .envIn .env:
OPENROUTER_API_KEY=sk-or-...
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
OPENROUTER_APP_NAME=InternAgent
OPENROUTER_SITE_URL=https://discovery.intern-ai.org.cnThe dedicated provider config is available at config/openrouter_config.yaml.
It sets:
models:
default_provider: "openrouter"
openrouter:
model_name: "moonshotai/kimi-k2.6:free"You can replace model_name with any OpenRouter model ID that supports chat
completions.
AutoDebug is the smallest built-in task and does not require external datasets:
python launch_discovery.py \
--config ./config/openrouter_config.yaml \
--task AutoDebug \
--exp_backend claudecodeThe --exp_backend claudecode experiment backend still requires its own
Anthropic/Claude Code setup. OpenRouter is used by InternAgent's main agent
model provider layer.
Instead of using config/openrouter_config.yaml, you can edit
config/default_config.yaml:
models:
default_provider: "openrouter"The openrouter provider block is already included in the default config.
launch_qa.py currently uses the Deep Research workflow's OpenAI-compatible
client directly. To route QA calls through OpenRouter, set the OpenAI-compatible
environment variables to OpenRouter:
OPENAI_API_KEY=$OPENROUTER_API_KEY
OPENAI_API_BASE_URL=https://openrouter.ai/api/v1
OPENAI_BASE_URL=https://openrouter.ai/api/v1Then run:
python launch_qa.py --question "What are recent advances in memory-augmented LLMs?"Authentication failed: check thatOPENROUTER_API_KEYis set in.env.Unsupported model: confirm the model ID exists in the OpenRouter model list.Unsupported model provider: openrouter: make sure your checkout includesinternagent/mas/models/openrouter_model.pyand the updatedmodel_factory.py.