Skip to content

feat(deepinfra): add DeepInfra API usage provider (0.45 port)#219

Closed
Finesssee wants to merge 1 commit into
mainfrom
port/045-deepinfra
Closed

feat(deepinfra): add DeepInfra API usage provider (0.45 port)#219
Finesssee wants to merge 1 commit into
mainfrom
port/045-deepinfra

Conversation

@Finesssee

@Finesssee Finesssee commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Port DeepInfra billing/usage provider from upstream steipete/CodexBar into the Windows Rust backend and Tauri UI wiring.

DeepInfra is API-key only. CodexBar queries DeepInfra's documented billing endpoints and never sends model prompts or account data to third parties.

Endpoints

Method URL Purpose
GET https://api.deepinfra.com/payment/checklist?compute_owed=true Prepaid balance (stripe_balance), recent spend, spending limit, suspension
GET https://api.deepinfra.com/payment/usage?from=current Current-month spend (total_cost in cents)

Auth: Authorization: Bearer <api_key>

Balance semantics (match upstream)

  • Negative stripe_balance = prepaid funds; convert to positive available after deducting recent
  • Positive net balance = amount owed
  • Monthly usage cents → USD via /100
  • Spending limit only applied when limit > 0
  • Suspended accounts reported as 100% used with reason text

Credentials

  • Preferences API key store / Windows Credential Manager (codexbar-deepinfra)
  • Env: DEEPINFRA_API_KEY (primary), DEEPINFRA_TOKEN (fallback)
  • Multi-key token accounts inject DEEPINFRA_API_KEY

Changes

  • New rust/src/providers/deepinfra/mod.rs with parse/fetch + fixture unit tests
  • Register ProviderId::DeepInfra in provider.rs, provider_factory.rs, providers/mod.rs
  • API key catalog + credential migration + token accounts
  • UI: icon SVG, registry, catalog, dashboard/status sets, API source label

Tests run

cargo test --manifest-path rust/Cargo.toml deepinfra
# 6 passed

cargo test --manifest-path rust/Cargo.toml every_provider_id_is_instantiable
# 1 passed

Notes / gaps vs upstream

  • Widget support still n/a (upstream also marks DeepInfra unsupported in widgets)
  • No live network tests (fixture-only, same as other API-key ports)
  • Per-request cost history still unavailable (matches upstream supportsTokenCost: false)

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Port DeepInfra billing provider from steipete/CodexBar:
- GET /payment/checklist?compute_owed=true for prepaid balance, recent spend, limit, suspension
- GET /payment/usage?from=current for monthly spend (cents -> USD)
- API key via Preferences, keyring, DEEPINFRA_API_KEY / DEEPINFRA_TOKEN
- Token accounts for multiple labeled keys
- Fixture unit tests for balance/owed/suspended parse paths
@github-actions

Copy link
Copy Markdown

This repository allows each user to open at most 4 pull requests per 7 days.

Closing this automatically.

@github-actions github-actions Bot closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant