Skip to content

feat(provider): first-class qBraid provider with baked-in models + auth login#9

Open
Kenny-Heitritter wants to merge 2 commits into
devfrom
feat/qbraid-first-class-provider
Open

feat(provider): first-class qBraid provider with baked-in models + auth login#9
Kenny-Heitritter wants to merge 2 commits into
devfrom
feat/qbraid-first-class-provider

Conversation

@Kenny-Heitritter
Copy link
Copy Markdown
Member

@Kenny-Heitritter Kenny-Heitritter commented May 28, 2026

Makes qbraid a first-class opencode provider so users authenticate via opencode auth login and the model catalog is baked into the binary (no dependency on an external models.dev api.json).

Changes

  • provider/qbraid-models.ts (new): QBRAID_MODELS_DEV catalog — Claude 4.5 Haiku, Claude 4.6 Sonnet, Claude Opus 4.8, Gemini 3.5 Flash, Gemini 3.1 Pro. Pricing/limits mirror qbraid-api MODEL_PRICING. api = https://account.qbraid.com/api/ai/v1, npm = @ai-sdk/qbraid.
  • provider/provider.ts: inject qbraid into the models database at state build (only if absent — config still overrides). Add CUSTOM_LOADERS.qbraid for QBRAID_API_KEY env autoload + stored-auth credential resolution, passing apiKey/baseURL to the SDK.
  • plugin/qbraid.ts (new) + plugin/index.ts: QBraidAuthPlugin registered in INTERNAL_PLUGINS. type: "api" login → prompts for a qBraid token (qbr-at_...), stored as standard API credential; loader wires apiKey+baseURL into the provider.
  • provider/sdk/qbraid/index.ts: default baseURL api.qbraid.com/ai/v1account.qbraid.com/api/ai/v1.

UX

  1. opencode auth loginqBraid → paste qbr-at_... token.
  2. Model picker shows qbraid/claude-sonnet-4-6, qbraid/gemini-3.5-flash, etc.
  3. Requests hit account.qbraid.com/api/ai/v1/chat/completions with Authorization: Bearer <token> → existing qbraid-account proxy validates + bills.

Model IDs are unprefixed; the proxy resolves them via MODEL_ALIASES (see qBraid/qbraid-account#431).

Notes

  • Config-based usage (provider.qbraid.options.{baseURL,apiKey}) keeps working unchanged.
  • Companion PRs: qBraid/qbraid-account#431 (model catalog/pricing/proxy), qBraid/qbraid-api#684 (backend pricing).

Verification

  • bun run typecheck (tsgo --noEmit): 0 errors.
  • bun test test/provider: 220 pass / 0 fail.
  • Could not exercise live auth flow end-to-end (needs a running qBraid proxy + valid token).

…th login

- add QBRAID_MODELS_DEV catalog (Claude Haiku/Sonnet 4.6/Opus 4.8, Gemini 3.5 Flash/3.1 Pro), injected into models database so qbraid provider does not depend on external models.dev
- add QBraidAuthPlugin (api-key login): opencode auth login -> qBraid -> paste qbr-at_ token
- add CUSTOM_LOADERS.qbraid for QBRAID_API_KEY env autoload + stored-auth credential resolution
- point qbraid SDK default baseURL to https://account.qbraid.com/api/ai/v1
- model IDs unprefixed (resolved server-side by AI proxy aliases)
- models.json + generate-models.ts: new model IDs (claude-opus-4-8,
  claude-sonnet-4-6, claude-haiku-4-5, gemini-3.5-flash, gemini-3.1-pro)
- correct Opus pricing 5/25, Sonnet 4.6 1M context
- baseURL -> https://account.qbraid.com/api/ai/v1
- remove Grok (xAI) and stale gpt-4o entries from generator
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