
OpenRouter Agents
STDIOAI-powered research orchestration system with multi-agent capabilities via OpenRouter models
AI-powered research orchestration system with multi-agent capabilities via OpenRouter models
[UPDATE – 2025-08-26] Two modes (set MODE env):
agent
) that routes research / follow_up / retrieve / queryDiagram (simple)
[Always-On Ops] ping • get_server_status • job_status • cancel_job
AGENT MODE
client → agent → (research | follow_up | retrieve | query)
MANUAL MODE
client → (submit_research | conduct_research | retrieve | query | research_follow_up | get_report_content | list_research_history)
npm install @terminals-tech/openrouter-agents
npm install -g @terminals-tech/openrouter-agents
npx @terminals-tech/openrouter-agents --stdio # or daemon SERVER_API_KEY=devkey npx @terminals-tech/openrouter-agents
npm install
OPENROUTER_API_KEY=your_openrouter_key SERVER_API_KEY=your_http_transport_key SERVER_PORT=3002 # Modes (pick one; default ALL) # AGENT = agent-only + always-on ops (ping/status/jobs) # MANUAL = individual tools + always-on ops # ALL = agent + individual tools + always-on ops MODE=ALL # Orchestration ENSEMBLE_SIZE=2 PARALLELISM=4 # Models (override as needed) - Updated with state-of-the-art cost-effective models PLANNING_MODEL=openai/gpt-5-chat PLANNING_CANDIDATES=openai/gpt-5-chat,google/gemini-2.5-pro,anthropic/claude-sonnet-4 HIGH_COST_MODELS=x-ai/grok-4,openai/gpt-5-chat,google/gemini-2.5-pro,anthropic/claude-sonnet-4,morph/morph-v3-large LOW_COST_MODELS=deepseek/deepseek-chat-v3.1,z-ai/glm-4.5v,qwen/qwen3-coder,openai/gpt-5-mini,google/gemini-2.5-flash VERY_LOW_COST_MODELS=openai/gpt-5-nano,deepseek/deepseek-chat-v3.1 # Storage PGLITE_DATA_DIR=./researchAgentDB PGLITE_RELAXED_DURABILITY=true REPORT_OUTPUT_PATH=./research_outputs/ # Indexer INDEXER_ENABLED=true INDEXER_AUTO_INDEX_REPORTS=true INDEXER_AUTO_INDEX_FETCHED=true # MCP features MCP_ENABLE_PROMPTS=true MCP_ENABLE_RESOURCES=true # Prompt strategy PROMPTS_COMPACT=true PROMPTS_REQUIRE_URLS=true PROMPTS_CONFIDENCE=true
node src/server/mcpServer.js --stdio
SERVER_API_KEY=$SERVER_API_KEY node src/server/mcpServer.js
$env:OPENROUTER_API_KEY='your_key' $env:INDEXER_ENABLED='true' node src/server/mcpServer.js --stdio
$env:OPENROUTER_API_KEY='your_key' $env:SERVER_API_KEY='devkey' $env:SERVER_PORT='3002' node src/server/mcpServer.js
Dev (HTTP/SSE):
SERVER_API_KEY=devkey INDEXER_ENABLED=true node src/server/mcpServer.js
STDIO (Cursor/VS Code):
OPENROUTER_API_KEY=your_key INDEXER_ENABLED=true node src/server/mcpServer.js --stdio
You can register this server directly in MCP clients that support JSON server manifests.
Minimal examples:
{ "servers": { "openrouter-agents": { "command": "npx", "args": ["@terminals-tech/openrouter-agents", "--stdio"], "env": { "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}", "SERVER_API_KEY": "${SERVER_API_KEY}", "PGLITE_DATA_DIR": "./researchAgentDB", "INDEXER_ENABLED": "true" } } } }
{ "servers": { "openrouter-agents": { "url": "http://127.0.0.1:3002", "sse": "/sse", "messages": "/messages", "headers": { "Authorization": "Bearer ${SERVER_API_KEY}" } } } }
With the package installed globally (or via npx), MCP clients can spawn the server automatically. See your client’s docs for where to place this JSON (e.g., ~/.config/client/mcp.json
).
ping
, get_server_status
, job_status
, get_job_status
, cancel_job
agent
(single entrypoint for research / follow_up / retrieve / query)submit_research
(async), conduct_research
(sync/stream), research_follow_up
, search
(hybrid), retrieve
(index/sql), query
(SELECT), get_report_content
, list_research_history
get_job_status
, cancel_job
search
(hybrid BM25+vector with optional LLM rerank), retrieve
(index/sql wrapper)query
(SELECT‑only, optional explain
)get_past_research
, list_research_history
, get_report_content
backup_db
(tar.gz), export_reports
, import_reports
, db_health
, reindex_vectors
list_models
search_web
, fetch_url
index_texts
, index_url
, search_index
, index_status
Use tool_patterns
resource to view JSON recipes describing effective chaining, e.g.:
/jobs/:id/events
, then get report contentNotes
PGLITE_DATA_DIR
(default ./researchAgentDB
). Backups are tarballs in ./backups
.list_models
to discover current provider capabilities and ids.See docs/diagram-architecture.mmd
(Mermaid). Render to SVG with Mermaid CLI if installed:
npx @mermaid-js/mermaid-cli -i docs/diagram-architecture.mmd -o docs/diagram-architecture.svg
Or use the script:
npm run gen:diagram
If the image doesn’t render in your viewer, open docs/diagram-architecture-branded.svg
directly.
How it differs from typical “agent chains”:
“Give me an executive briefing on MCP status as of July 2025.”
“Find vision‑capable models and route images gracefully.”
/models
discovered and filtered, router template generated, fallback to text models.“Compare orchestration patterns for bounded parallelism.”
node src/server/mcpServer.js --stdio
.planning_prompt
, synthesis_prompt
) directly in Cursor to scaffold tasks.npm run stdio
npm start
npx @terminals-tech/openrouter-agents --stdio
npm run gen:examples
list_models { refresh:false }
submit_research { q:"<query>", cost:"low", aud:"intermediate", fmt:"report", src:true }
get_job_status { job_id:"..." }
, cancel: cancel_job { job_id:"..." }
search { q:"<query>", k:10, scope:"both" }
query { sql:"SELECT ... WHERE id = $1", params:[1], explain:true }
get_past_research { query:"<query>", limit:5 }
index_url { url:"https://..." }
http://localhost:3002/ui
to stream job events (SSE).@terminals-tech/openrouter-agents
openrouter-agents
Install and run without cloning:
npx @terminals-tech/openrouter-agents --stdio # or daemon SERVER_API_KEY=your_key npx @terminals-tech/openrouter-agents
npm login npm version 1.3.2 -m "chore(release): %s" git push --follow-tags npm publish --access public --provenance
[Unverified]
.rate_research_report { rating, comment }
stored to DB; drives follow‑ups.export_reports
+ backup_db
capture artifacts for audit.npm run gen:examples
list_research_history
, get_report_content {reportId}
rate_research_report { reportId, rating:1..5, comment }
reindex_vectors
, index_status
, search_index { query }
docs/diagram-architecture-branded.svg
(logo links to https://terminals.tech
).