yalethom.as/txtop

Connect a provider API

Provider APIs add organization usage and reported cost data for OpenAI, Anthropic, and OpenRouter. They are separate from local coding-subscription history.

Choose the credential

Set the credential for the provider you want to read:

export OPENAI_ADMIN_KEY="..."
export ANTHROPIC_ADMIN_KEY="..."
export OPENROUTER_API_KEY="..."
txtop

OpenAI and Anthropic usage endpoints commonly require organization or administrator credentials. Regular OPENAI_API_KEY and ANTHROPIC_API_KEY values can make model requests but may not have permission to read organization usage. txtop also recognizes OPENAI_ADMIN_API_KEY and ANTHROPIC_ADMIN_API_KEY.

Providers auto-enable when a recognized credential is present. To use a custom environment variable, configure it explicitly:

[providers.openai]
enabled = true
api_key_env = "WORK_OPENAI_ADMIN_KEY"

Prefer environment variables to storing api_key in config.toml.

Verify the first refresh

Open txtop and press r. Provider failures remain scoped to that provider, so one authorization error does not blank other data.

Press D to inspect provider status. For database-level detail, run:

txtop db doctor
txtop db events --last 20

A 401 or 403 from OpenAI or Anthropic usually means the credential lacks the required organization role. A successful credential can still show no history when the account has no usage in the requested window.

See the configuration reference for base URLs, backfill, environment-variable names, and precedence. See where the numbers come from before comparing API totals with local subscription usage.