Command Palette

Search for a command to run...

Back to skills
skill № 35124

openusage-provider

Add new AI usage providers to the OpenUsage TUI dashboard.

FreeNo executable scripts
janekbaraniewskiby 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
Sign up freeI already have an account

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:

  1. 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)
  2. Authentication method — which of these applies?

    • api_key — user sets an env var like PROVIDER_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 via gh)
    • local — reads local files/databases (e.g. Claude Code stats)
    • token — extracted from local storage (e.g. Cursor IDE token from SQLite)
  3. If API key auth: What is the env var name? (e.g. XAI_API_KEY)

  4. 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
  5. 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
  6. API documentation URL — link to the provider's rate-limit or usage docs

  7. Base URL — the API base (e.g. https://api.openai.com/v1)

  8. Probe model (if using header probing) — a cheap/default model to use for the probe request (e.g. gpt-4.1-mini)

  9. 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)
  10. 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:

  1. Define a Provider struct that embeds providerbase.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
}
  1. Implement a New() constructor that registers the ProviderSpec:
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>))
        }),
    }
}
  1. *Implement the Fetch() method
Full SKILL.md on GitHub

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

Compare openusage-provider with