-
Notifications
You must be signed in to change notification settings - Fork 88
Description
Provider Name
OpenRouter
Provider Website
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_KEYto 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