Skip to content

Resolve LLM API Base and Models#317

Open
octovimmer wants to merge 3 commits intomainfrom
models-strix
Open

Resolve LLM API Base and Models#317
octovimmer wants to merge 3 commits intomainfrom
models-strix

Conversation

@octovimmer
Copy link
Collaborator

No description provided.

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

greptile-apps bot commented Feb 20, 2026

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
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

Comments