Skip to content

Title: Add OpenRouter Provider and first-class OpenRouter Agent for zero-cost development #7182

@ARtoRiAs10

Description

@ARtoRiAs10

Problem Statement
The framework currently supports major proprietary LLM providers like OpenAI, Anthropic, Gemini, and Groq. While powerful, these require individual API keys and often incur costs or have strict tier limitations, which creates a barrier for new contributors and developers who want to test the framework’s agentic capabilities without financial overhead.

Furthermore, there is currently no "out-of-the-box" reference agent that demonstrates the full suite of Hive capabilities—such as session memory, TUI model picking, and tool integration—using entirely free, open-source models.

Proposed Solution
Integrate OpenRouter as a first-class provider and introduce a dedicated OpenRouter Agent.

OpenRouter Provider: Implement a new backend that wraps LiteLLMProvider to access 100+ open-source models (Llama 3, Mistral, DeepSeek, etc.) via the OpenRouter API. This should include an automatic fallback chain to handle 429 rate limits across free models.

Credential Management: Register OpenRouter in the Hive credential store (openrouter key) to prevent KeyError exceptions during configuration.

OpenRouter Agent: Build a functional agent package that utilizes these free models to perform general-purpose tasks. This agent will serve as the framework’s primary zero-cost entry point for users.

Alternatives Considered
Local LLMs (Ollama): While local execution is zero-cost, it requires significant hardware resources (RAM/GPU) that not all contributors possess. OpenRouter provides the same "free" benefit via the cloud with zero local setup.

Individual OS Providers: Integrating Hugging Face or Together.ai individually would require multiple API specs. OpenRouter acts as a single multiplexer, simplifying the codebase.

Additional Context
This feature is designed to be purely additive. By using a try/except wrapper on the new exports and adding an elif branch in the runner for API key resolution, we ensure that existing workflows for OpenAI or Gemini users remain unaffected.

The implementation follows the established pattern of the credential_tester agent but expands on it with persistent storage.

Implementation Ideas
Provider Logic: Create core/framework/llm/openrouter.py to handle the specific endpoint requirements and a "free-model" registry.

Session Memory: Use a markdown-based persistence layer (~/.hive/openrouter_agent/MEMORY.md) where the LLM automatically summarizes past interactions to maintain context across CLI sessions.

Tooling: Equipping the agent with web_search, read_file, and write_file by default to showcase the framework’s tool-calling reliability on open-source models.

Runner Update: Modify runner.py to recognize the openrouter/ model prefix so the system knows to look for OPENROUTER_API_KEY in the environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions