Skip to content

Subscription-Backed Model Support (Umbrella) #103

@davidste

Description

@davidste

Summary

Add subscription-backed model support as a first-class Loomkin runtime path, while keeping the current API-key req_llm path fully functional.

This is the umbrella issue. The implementation is split so we can ship in stages, verify each provider path properly, and avoid one huge risky PR.

Problem

  • Loomkin currently routes model execution through API-key provider flows only.
  • There is no subscription OAuth lifecycle in the app yet (auth start, callback, refresh, revoke).
  • Current config parsing does not yet support subscription auth/provider sections as first-class runtime config.
  • Provider discovery and cost tracking are currently tuned for API-key usage, not subscription-backed auth/accounting modes.

Verified Constraints (as of March 3, 2026)

  • Runtime model calls are driven by provider:model strings and ReqLLM.stream_text/3.
  • No /login auth command/callback flow exists in the current LiveView/router stack.
  • req_llm in this repo supports zai_coder and zai_coding_plan already.
  • Moonshot/MiniMax need explicit provider strategy in Loomkin runtime (native provider module, registered custom provider, or dependency update path).

Delivery Plan (Split)

This umbrella is delivered by:

Scope

In scope

  • Subscription auth foundation (OAuth lifecycle, token lifecycle, secure storage).
  • Anthropic subscription adapter path.
  • Codex and Gemini subscription adapter paths.
  • Coding-plan API provider path for Z.AI, Moonshot, and MiniMax.
  • Cost and budget semantics for subscription-backed requests.

Out of scope

  • Removing or replacing existing API-key model execution.
  • Shipping all providers in a single PR.
  • Unrelated agent-loop architecture rewrites.

Cross-Issue Requirements

  • Backward compatibility: existing API-key model flow must keep working.
  • Explicit fallback behavior when subscription auth is missing/expired/disabled.
  • Token/account secrets must be redacted in logs, events, and UI surfaces.
  • Config validation errors must be actionable and user-facing.
  • Subscription-backed usage must produce deterministic budget behavior.

Umbrella Acceptance Criteria

  • All child issues listed above are completed and merged.
  • Subscription auth + provider configuration is documented in one place.
  • End-to-end flows verified for Anthropic, Codex, Gemini, and coding-plan providers.
  • Existing API-key paths pass regression checks after rollout.
  • Dashboard/session reporting correctly reflects subscription-backed usage accounting.

Implementation Touchpoints

  • lib/loomkin/config.ex
  • lib/loomkin/models.ex
  • lib/loomkin/agent_loop.ex
  • lib/loomkin/session/architect.ex
  • lib/loomkin/teams/agent.ex
  • lib/loomkin/teams/cost_tracker.ex
  • lib/loomkin/teams/pricing.ex
  • lib/loomkin_web/live/workspace_live.ex
  • lib/loomkin_web/live/model_selector_component.ex
  • lib/loomkin_web/router.ex

Related GitHub Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions