openusage-provider
Add new AI usage providers to the OpenUsage TUI dashboard.
by janekbaraniewski★ 251 GitHub stars
Install openusage-provider in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
OpenUsage Provider Skill
Invocation: When a user asks to add, create, or implement a new AI provider to OpenUsage.
You are implementing a new AI usage/quota provider for the OpenUsage TUI dashboard. This is a multi-step process. Follow every step precisely.
Phase 0 — Quiz the User (MANDATORY)
Before writing any code, you MUST gather all of the following information. Ask these questions conversationally but DO NOT proceed until every answer is obtained. If the user doesn't know an answer, research it yourself (check the provider's docs, API reference, etc).
Questions to ask:
Provider name & ID
- What is the human-readable name? (e.g. "OpenAI", "DeepSeek", "Gemini CLI")
- What should the snake_case provider ID be? (e.g.
openai,deep_seek,gemini_cli)
Authentication method — which of these applies?
api_key— user sets an env var likePROVIDER_API_KEY(most common for API providers)oauth— OAuth flow with stored credentials (e.g. Gemini CLI)cli— shells out to a CLI binary (e.g. GitHub Copilot viagh)local— reads local files/databases (e.g. Claude Code stats)token— extracted from local storage (e.g. Cursor IDE token from SQLite)
If API key auth: What is the env var name? (e.g.
XAI_API_KEY)Data source — how do we get usage data?
- HTTP API with rate-limit headers (probe a lightweight endpoint like
/v1/models) - Dedicated usage/balance REST endpoint (e.g. DeepSeek
/user/balance) - Local files (stats JSON, session files, SQLite databases)
- CLI subprocess output
- Combination of the above
- HTTP API with rate-limit headers (probe a lightweight endpoint like
What metrics are available? Try to identify:
- Rate limits: RPM, TPM, RPD, TPD (from headers or API)
- Spending: balance, credits, daily/weekly/monthly spend
- Usage: messages, tokens (input/output/reasoning), sessions, tool calls
- Account metadata: plan name, email, org, billing cycle
API documentation URL — link to the provider's rate-limit or usage docs
Base URL — the API base (e.g.
https://api.openai.com/v1)Probe model (if using header probing) — a cheap/default model to use for the probe request (e.g.
gpt-4.1-mini)Color role for the dashboard tile — pick one that doesn't conflict with existing providers:
green(OpenAI),peach(Anthropic),lavender(Cursor),blue(Gemini CLI)sky(DeepSeek),teal(xAI),yellow(Groq),sapphire(Mistral)rosewater(OpenRouter),maroon(Copilot),flamingo(Codex),auto(Claude Code)
Does the provider support per-model usage breakdowns? (for the Analytics tab)
Phase 1 — Research
Before coding, look up the provider's API docs to understand:
- Exact HTTP endpoints, methods, headers
- Response JSON schemas
- Rate-limit header names and formats
- Any balance/credits/usage endpoints
- Authentication header format (
Bearer,x-api-key, etc.) - Error response codes and their meaning (401, 403, 429)
Document your findings in a brief summary before proceeding.
Phase 2 — Create the Provider Package
2.1 Directory structure
Create internal/providers/<provider_id>/ with these files:
internal/providers/<provider_id>/
├── <provider_id>.go # Provider struct + Fetch() implementation
├── <provider_id>_test.go # Tests
└── widget.go # Dashboard widget configuration (only if customizing beyond defaults)
2.2 Provider implementation (<provider_id>.go)
The provider MUST:
- Define a
Providerstruct that embedsproviderbase.Base:
package <provider_id>
import (
"context"
"fmt"
"net/http"
"time"
"github.com/janekbaraniewski/openusage/internal/core"
"github.com/janekbaraniewski/openusage/internal/parsers"
"github.com/janekbaraniewski/openusage/internal/providers/providerbase"
)
const (
defaultBaseURL = "https://api.<provider>.com/v1"
)
type Provider struct {
providerbase.Base
}
- Implement a
New()constructor that registers theProviderSpec:
func New() *Provider {
return &Provider{
Base: providerbase.New(core.ProviderSpec{
ID: "<provider_id>",
Info: core.ProviderInfo{
Name: "<Provider Name>",
Capabilities: []string{"headers"},
DocURL: "https://docs.<provider>.com/rate-limits",
},
Auth: core.ProviderAuthSpec{
Type: core.ProviderAuthTypeAPIKey,
APIKeyEnv: "<PROVIDER_API_KEY>",
DefaultAccountID: "<provider_id>",
},
Setup: core.ProviderSetupSpec{
Quickstart: []string{"Set <PROVIDER_API_KEY> to a valid API key."},
},
Dashboard: dashboardWidget(), // or providerbase.DefaultDashboard(providerbase.WithColorRole(core.DashboardColorRole<Color>))
}),
}
}
- *Implement the
Fetch()method
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- README.md
- skill.json
FAQ
What does the openusage-provider skill do?
Add new AI usage providers to the OpenUsage TUI dashboard.
How do I install the openusage-provider skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the openusage-provider skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…