Skip to content

Resolve LLM API Base and Models#317

Merged
0xallam merged 4 commits into
mainfrom
models-strix
Feb 20, 2026
Merged

Resolve LLM API Base and Models#317
0xallam merged 4 commits into
mainfrom
models-strix

Conversation

@octovimmer

Copy link
Copy Markdown
Contributor

No description provided.

@octovimmer octovimmer requested a review from 0xallam February 20, 2026 01:40
@greptile-apps

greptile-apps Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR refactors LLM model name handling to separate concerns between configuration and API calls. Previously, resolve_llm_config() converted strix/ prefixed models to openai/ format, but this caused issues with model identification and cost calculation throughout the codebase.

Key Changes:

  • resolve_llm_config() now returns the original model name with strix/ prefix preserved
  • New get_litellm_model_name() utility centralizes conversion from strix/ to litellm provider format (anthropic/, openai/, gemini/)
  • All litellm API calls now use the converted model name for proper provider routing
  • Cost extraction improved to check response.usage.cost before falling back to completion_cost() with explicit model parameter
  • Added defensive or 0 checks for token counts to handle None values
  • Import organization improved in main.py

The refactoring ensures model names are consistently handled across the codebase and fixes issues with provider-specific features like vision support, reasoning, and prompt caching detection.

Confidence Score: 5/5

  • This PR is safe to merge - well-structured refactoring with clear separation of concerns
  • The changes follow a clean architectural pattern: preserve original model names in config, convert only when calling litellm APIs. All call sites are updated consistently, defensive programming is added for token counts, and the logic is centralized in a single utility function. The refactoring improves code maintainability and fixes real issues with model detection.
  • No files require special attention

Important Files Changed

Filename Overview
strix/config/config.py Preserves original model name with strix/ prefix instead of converting to openai/ format, simplifying the config resolution logic
strix/llm/utils.py Adds get_litellm_model_name() function to centralize model name conversion from strix/ prefix to litellm provider format
strix/llm/llm.py Uses centralized _get_litellm_model_name() for all litellm API calls, fixes cost extraction logic, adds defensive or 0 for token counts
strix/interface/main.py Converts model name to litellm format in LLM warmup, moves imports to top level for consistency
strix/llm/dedupe.py Converts model name to litellm format before making completion call
strix/llm/memory_compressor.py Converts model name to litellm format for token counting and summarization calls

Last reviewed commit: d2c99ea

…ability names

- Replace fragile prefix matching with explicit STRIX_MODEL_MAP
- Add resolve_strix_model() returning (api_model, canonical_model)
- api_model (openai/ prefix) for API calls to OpenAI-compatible Strix API
- canonical_model (actual provider name) for litellm capability lookups
- Centralize resolution in LLMConfig instead of scattered call sites
@0xallam 0xallam merged commit 6166be8 into main Feb 20, 2026
1 check passed
@0xallam 0xallam deleted the models-strix branch February 20, 2026 15:14
carcraze pushed a commit to carcraze/strix that referenced this pull request Mar 10, 2026
Josz009 pushed a commit to Josz009/strix that referenced this pull request May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants