Skip to content

feat: fetch full model list from gateway for app model picker#1347

Open
MysticCoss wants to merge 2 commits into
slopus:mainfrom
MysticCoss:main
Open

feat: fetch full model list from gateway for app model picker#1347
MysticCoss wants to merge 2 commits into
slopus:mainfrom
MysticCoss:main

Conversation

@MysticCoss

Copy link
Copy Markdown

Summary

Mobile app's model picker only showed 4 hardcoded Claude aliases (default, opus, sonnet, haiku) — even when connected to a gateway with 100+ available models (using free-claude-code for example). This fetches the full catalog from the
gateway's /v1/models at session start so the app displays every model the gateway exposes: provider models, 1M-context variants, everything. When no gateway is configured, it falls back to the existing
hardcoded list plus SDK-reported models.

What changed

  • fetchAvailableModels.ts (new) — GET /v1/models from ANTHROPIC_BASE_URL, merges with 4 hardcoded aliases, deduplicates, falls back on any error
  • runClaude.ts — applies gateway env vars early, seeds metadata.models with the full list, propagates currentModelCode on model selection
  • claudeRemote.ts — adds onModelsFound callback from supportedModels()
  • claudeRemoteLauncher.ts — merges SDK models as fallback enrichment

Proof

Tested end-to-end with a gateway that exposes 135+ models. Before: 4 models in the picker. After: all gateway models appear and are selectable. Fallback path works correctly with ANTHROPIC_BASE_URL unset.

Behavior

ANTHROPIC_BASE_URL Models shown
Not set 4 hardcoded + SDK models
Gateway configured 4 aliases + full gateway catalog

Populates metadata.models with the complete model catalog from the
Anthropic-compatible gateway (/v1/models) so the iOS app shows all
available models — provider models, 1M-context variants, and
discoverable models — instead of only the 4 hardcoded Claude aliases.

The SDK's supportedModels() provides a fallback enrichment for when
no gateway is configured (original Claude Code).

Co-Authored-By: Happy <yesreply@happy.engineering>
@MysticCoss

Copy link
Copy Markdown
Author

@bra1nDump hello, this is a simple but powerful improvement that makes intergration with free-claude-code smooth. Please review it

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