altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

Not all available models in Snowflake Cortex can be selected

Open FrankTub opened this issue 6 months ago • 2 comments

I expected that all models available in Snowflake Cortex could be selected in altimate-code. This does not seem to be the case — for example, Claude Opus 4.7 cannot be selected even though it is listed in Snowflake's own docs: https://docs.snowflake.com/en/user-guide/snowflake-cortex/aisql-regional-availability

Possible root cause:

This may be caused by Snowflake Cortex not implementing their models API endpoint in the same way as OpenAI.

Feedback from Snowflake:

Snowflake Cortex does have a GA OpenAI-compatible Chat Completions API, so the claim is correct for that specific endpoint: POST https://<account>.snowflakecomputing.com/api/v2/cortex/v1/chat/completions

However, tools like JetBrains AI Assistant typically probe /v1/models first to list available models, and Snowflake's models endpoint has a non-standard behaviour (requires a JSON body on GET) that breaks most standard clients before any inference call is made.


Metadata

Field Value
CLI Version 0.7.3
Platform darwin
Architecture arm64
OS Release 25.5.0
Category bug

FrankTub avatar May 29 '26 13:05 FrankTub

Thanks @FrankTub — reproduced and confirmed your diagnosis.

Repro

altimate-code does not call /v1/models against Cortex (so the Snowflake feedback about the non-standard GET semantics is correct in principle but doesn't apply to how altimate-code lists models today). Instead, the model list is hardcoded in packages/opencode/src/provider/provider.ts:1024-1122 via repeated makeSnowflakeModel(...) calls, then served to the picker through Provider.list() → GET /config/providers. That list had drifted behind Snowflake's regional availability matrix.

Cross-referencing the docs against the hardcoded list (as of main HEAD 6ad8b472c):

Missing in altimate-code, selectable in Cortex:

Model Family Notes
claude-opus-4-7 Claude exactly what you flagged
openai-gpt-5.1 OpenAI
openai-gpt-5.2 OpenAI
llama4-scout Llama
llama3.3-70b Llama only the snowflake-llama-3.3-70b variant was listed
snowflake-llama-3.1-405b Llama
gemini-3.1-pro Gemini first Gemini on Cortex
mixtral-8x7b Mistral

Hardcoded but no longer in Snowflake's current matrix (may still work, may be legacy): claude-3-7-sonnet, claude-3-5-sonnet, openai-gpt-5-chat. Left in place — removing them would be a separate decision.

Fix — PR #866

  1. Added all 8 missing models with correct context/output limits and toolcall capability per the rule on snowflake.ts:6 (only Claude+OpenAI reliably support tools on Cortex today; Gemini set to toolcall: false until confirmed).
  2. Updated TOOLCALL_MODELS so request transform doesn't strip tools from the new Claude/OpenAI entries.
  3. Documented the existing-but-undocumented config-extension escape hatch: opencode.json entries under provider['snowflake-cortex'].models already merge into the built-in list (mechanism at provider.ts:1320-1399), so users can patch around the next drift themselves without forking or waiting for a release. New section in docs/docs/configure/providers.md shows the JSON pattern.
  4. Regression tests in test/provider/snowflake.test.ts lock in each new model and exercise the config-extension path end-to-end. 50 → 52 tests pass; typecheck clean.

@anandgupta42 — input wanted on long-term auto-discovery

The PR fixes today's drift but the underlying coupling (Snowflake ships models, we manually update a list, eventually drift again) will recur. A few options to discuss before doing more work:

  1. Status quo + escape hatch (what this PR ships): rely on the now-documented opencode.json override for users who hit drift before we update the hardcoded list. Pro: zero ongoing work. Con: every Cortex addition is a CLI release away from the picker, every user redoes the override.
  2. Periodic sync script: a script that scrapes/parses the Snowflake regional availability page and regenerates the makeSnowflakeModel(...) calls, run on a cron or pre-release. Pro: no runtime risk, removes manual drift. Con: brittle to docs page restructures.
  3. True auto-discovery: a Snowflake-specific shim that probes POST /api/v2/cortex/v1/models (or the GET-with-JSON-body variant Snowflake actually serves) at startup, falls back to the hardcoded list on failure. Pro: zero drift. Con: extra network call on every CLI start, need to handle auth/timeout/Snowflake API churn gracefully.

Lean toward (3) myself given Snowflake adds models monthly, but the failure modes are worth a discussion. Happy to scope and prototype whichever direction you prefer in a follow-up.

sahrizvi avatar Jun 01 '26 11:06 sahrizvi

Resolved in v0.8.1.

anandgupta42 avatar Jun 03 '26 19:06 anandgupta42