Skip to content

Add OpenRouter provider plugin #155

@Siddharaj6010

Description

@Siddharaj6010

Provider Name

OpenRouter

Provider Website

https://openrouter.ai

What usage data does this provider expose?

OpenRouter exposes credit balance and usage data via their REST API:

  • Total usage (USD spent): lifetime, daily, weekly, monthly breakdowns
  • Spending limit (if configured): hard cap set by user
  • Remaining credits: limit minus usage
  • Free tier detection: boolean flag

API Endpoint: GET https://openrouter.ai/api/v1/key
Auth method: Bearer token with a standard OpenRouter API key
Response fields: usage, usage_daily, usage_monthly, limit, limit_remaining, is_free_tier

Will you build the plugin?

Yes, I will submit a PR

Additional Context

I have a working implementation locally with tests passing. One thing worth discussing before submitting the PR:

API key storage: Unlike other providers (Claude, Codex, Copilot, etc.), OpenRouter doesn't have a desktop app or CLI that stores credentials locally. The current implementation reads the API key from a config file in pluginDataDir (config.json with {"apiKey": "sk-or-..."}).

Possible alternatives:

  • Add OPENROUTER_API_KEY to the env var whitelist (one-line Rust change) — many devs already have this set in their shell
  • Wait for the OAuth flow discussed in Add proper OAuth flow to plugin API #71

Would love guidance on the preferred approach before submitting the PR.

API docs: https://openrouter.ai/docs/api/api-reference/api-keys/get-current-key

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions