Skip to content

feat(models): cap free workspaces to low-tier models#924

Merged
harshithmullapudi merged 1 commit into
mainfrom
feat/free-users-low-models
Jul 1, 2026
Merged

feat(models): cap free workspaces to low-tier models#924
harshithmullapudi merged 1 commit into
mainfrom
feat/free-users-low-models

Conversation

@saimanoj

Copy link
Copy Markdown
Contributor

Summary

Free workspaces were resolving to top-tier models for chat and most LLM work. This change forces free plans to the "low" model tier when billing is enabled. PRO/MAX, self-hosted (billing disabled), and explicit model overrides are unaffected.

Two paths sent free users to top-tier models; both are fixed at their chokepoints in apps/webapp/app/services/llm-provider.server.ts:

Part A — routed path (getModelForUseCase) — memory, search, sub-agents, titles, summaries, etc. After the explicit-override check, if billing is enabled and the workspace isn't on a paid plan, the effective complexity is forced to "low". planType is read from the existing workspace query (added Subscription to the select — no extra round-trip).

Part B — main chat agent — previously used getDefaultChatModelId() = env.MODEL for every plan (the real "high model for everything"). New resolveDefaultChatModelId(workspaceId):

  • free → DB "low" tier (honoring a modelConfig.chat override)
  • paid / billing-off / no-workspace → env.MODEL (unchanged)

Wired into the 3 chat entry points (api.v1.conversation._index.tsx, no-stream-process.ts, api.v1.voice.turn.tsx), keeping body.modelId precedence so an explicit per-request model still wins.

Decisions encoded

  • Cap level: free → "low" for everything
  • Billing disabled (self-hosted): no downgrade
  • Explicit overrides: honored over the cap
  • Low model source: existing DB "low" complexity routing (no new env var)

Net effect

PRO/MAX and self-hosted are byte-for-byte unchanged; only free hosted workspaces drop to low-tier.

Test plan

  • New llm-provider-plan-tier.test.ts — 12 tests, written test-first (confirmed RED → GREEN). Covers FREE cap, override honored, PRO/MAX untouched, billing-off, no-workspace, and the chat resolver.
  • Typecheck: 0 new type errors (296 pre-existing, identical with/without this change).
  • Lint: 0 errors in touched files.
  • All runnable unit tests pass.

🤖 Generated with Claude Code

Free workspaces resolved to top-tier models for chat and most LLM work.
Now, when billing is enabled, free plans are forced to the "low" tier;
PRO/MAX, self-hosted (billing disabled), and explicit model overrides
are unaffected.

- getModelForUseCase: cap effective complexity to "low" for non-paid
  plans (after the explicit modelConfig override check), fetching planType
  via the existing workspace query.
- resolveDefaultChatModelId: new plan-aware resolver for the main chat
  agent, which previously always used env.MODEL. Free -> DB low tier
  (honoring modelConfig.chat); paid / billing-off / no-workspace ->
  env.MODEL.
- Wire resolveDefaultChatModelId into the chat entry points
  (conversation, no-stream, voice), keeping body.modelId precedence.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@harshithmullapudi harshithmullapudi merged commit 9bb7a75 into main Jul 1, 2026
1 check passed
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.

2 participants