Skip to content

fix: use correct AI model names and respect provider-specific env vars#77

Open
clneagu wants to merge 1 commit into
jnsahaj:mainfrom
clneagu:fix-ai-models
Open

fix: use correct AI model names and respect provider-specific env vars#77
clneagu wants to merge 1 commit into
jnsahaj:mainfrom
clneagu:fix-ai-models

Conversation

@clneagu

@clneagu clneagu commented Dec 31, 2025

Copy link
Copy Markdown
Contributor
  • Update default models to actual current versions:

    • OpenAI: gpt-4o-mini (was gpt-5-mini)
    • Claude: claude-sonnet-4-5-20250929 (was claude-sonnet-4-5-20250930)
    • Gemini: gemini-1.5-flash (was gemini-3-flash)
    • xAI: grok-beta (was grok-4-mini-fast)
    • OpenRouter/Vercel: anthropic/claude-sonnet-4.5
  • Only set provider env var from config api_key if env var is not already set This allows using -p flag to switch providers when env vars are configured

  • Update README with correct model names for all providers

Summary by CodeRabbit

  • Documentation

    • Updated supported AI models and default selections across all providers (OpenAI, Claude, Gemini, Groq, DeepSeek, xAI)
    • Configuration examples and environment variable references refreshed
  • Changes

    • Enhanced API key handling to prevent overwriting pre-existing provider environment variables

✏️ Tip: You can customize this high-level summary in your review settings.

- Update default models to actual current versions:
  - OpenAI: gpt-4o-mini (was gpt-5-mini)
  - Claude: claude-sonnet-4-5-20250929 (was claude-sonnet-4-5-20250930)
  - Gemini: gemini-1.5-flash (was gemini-3-flash)
  - xAI: grok-beta (was grok-4-mini-fast)
  - OpenRouter/Vercel: anthropic/claude-sonnet-4.5

- Only set provider env var from config api_key if env var is not already set
  This allows using -p flag to switch providers when env vars are configured

- Update README with correct model names for all providers
@coderabbitai

coderabbitai Bot commented Dec 31, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Documentation and code updated to reflect new default AI models across multiple providers (OpenAI, Claude, Gemini, Groq, DeepSeek, xAI) and API key environment variable handling modified to prevent overwriting pre-existing provider-specific environment variables.

Changes

Cohort / File(s) Summary
Documentation Updates
README.md
CLI and config examples updated with new default model gpt-4o-mini; Supported Providers table refreshed with current model names and defaults for all six providers (OpenAI, Claude, Gemini, Groq, DeepSeek, xAI); JSON configuration snippet and precedence example aligned with new defaults.
Provider Configuration & API Key Handling
src/provider/mod.rs
Default models updated for Openai (gpt-4o-mini), Claude (claude-sonnet-4-5-20250929), Gemini (gemini-1.5-flash), and Xai (grok-beta); API key environment variable logic modified to only set env var if not already present, preventing overwrite of pre-existing provider-specific keys.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A hop through the models we go,
Four-oh and Sonnet steal the show,
No more overwrites with hasty keys,
Environment vars rest with ease,
Our providers dance in harmony!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main changes: updating AI model names to correct versions and fixing provider environment variable handling behavior.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/provider/mod.rs (1)

80-82: Inconsistent environment variable handling for OpenRouter/Vercel.

The native providers (lines 133-137) only set the environment variable if it's not already present, but OpenRouter and Vercel unconditionally overwrite the env var. This inconsistency prevents the -p flag from working correctly when switching to these providers if their env vars are already set.

🔎 Proposed fix to respect existing env vars
-                if let Some(key) = api_key {
-                    std::env::set_var(auth_env_key, key);
+                if let Some(key) = api_key {
+                    if std::env::var(auth_env_key).is_err() {
+                        std::env::set_var(auth_env_key, key);
+                    }
                 }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc281da and 1381c96.

📒 Files selected for processing (2)
  • README.md
  • src/provider/mod.rs
🔇 Additional comments (2)
src/provider/mod.rs (1)

132-137: LGTM! Correctly respects existing environment variables.

The logic properly checks that the env var is not already set before overwriting it. This enables the -p flag to work correctly when switching providers even when provider-specific environment variables are configured.

README.md (1)

204-204: LGTM! Documentation properly updated to reflect code changes.

All model name references have been consistently updated throughout the README to match the new defaults in src/provider/mod.rs. The changes are accurate and well-aligned with the code modifications.

Also applies to: 209-209, 216-221, 247-247, 278-278

Comment thread src/provider/mod.rs
_ => {
let (default_model, name, env_key) = match provider_type {
ProviderType::Openai => ("gpt-5-mini", "OpenAI", "OPENAI_API_KEY"),
ProviderType::Openai => ("gpt-4o-mini", "OpenAI", "OPENAI_API_KEY"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

OpenAI gpt-4o-mini model current API

💡 Result:

Here’s the current OpenAI API summary for the GPT-4o‑mini model (official docs/news):

  • Model summary: fast, cost‑efficient small multimodal model (text + vision), optimized for focused tasks and fine‑tuning; 128k token context window; up to 16k output tokens per request. [1][2]
  • Where to call: supported on Responses (v1/responses), Chat Completions (v1/chat/completions), Realtime, Assistants, Batch, and Fine-tuning endpoints. [1][4]
  • Pricing (text tokens): input $0.15 / 1M tokens, output $0.60 / 1M tokens (per OpenAI announcement). [2][5]
  • Features: streaming, function calling, structured outputs, fine‑tuning supported; snapshots available to pin versions. [1][5]
  • Variants: also available as a TTS-specialized model (gpt-4o-mini-tts) with its own snapshots and rate limits. [4]
  • Notes/updates: OpenAI has since released GPT‑4.1 series (incl. GPT‑4.1 mini) which supersedes GPT‑4o‑mini in some product flows; check model picker/docs if you need the latest recommended small model. [3][2]

Sources:
[1] OpenAI Platform — GPT-4o mini docs.
[2] OpenAI blog announcement — “GPT‑4o mini” (July 18, 2024).
[3] OpenAI release notes / Help Center (model updates; GPT‑4.1 mini replacement notice).
[4] OpenAI Platform — GPT‑4o mini TTS docs.
[5] OpenAI Platform — GPT-4o model pricing & features.

Would you like example API calls (Requests/JSON) for v1/responses or v1/chat/completions using gpt-4o-mini?


🌐 Web query:

Anthropic Claude claude-sonnet-4-5-20250929 model API

💡 Result:

Summary — what it is

  • "claude-sonnet-4-5-20250929" is Anthropic’s Claude Sonnet 4.5 model release (versioned 2025‑09‑29), available via the Anthropic/Claude API and through partners (Amazon Bedrock, Google Vertex AI). [1][2][3][4]

Quick usage example (Anthropic / Claude API)

  • Model identifier: "claude-sonnet-4-5-20250929".
  • Minimal cURL POST to /v1/messages:
    curl https://api.anthropic.com/v1/messages
    -H "Content-Type: application/json"
    -H "x-api-key: $ANTHROPIC_API_KEY"
    -H "anthropic-version: 2023-06-01"
    -d '{
    "model":"claude-sonnet-4-5-20250929",
    "max_tokens":1024,
    "messages":[{"role":"user","content":"Hello, Claude"}]
    }'
    The /v1/messages docs show this request/response format. [5]

Partner endpoints / alternate names

  • Amazon Bedrock example ID: anthropic.claude-sonnet-4-5-20250929-v1:0.
  • Google Vertex AI example ID: claude-sonnet-4-5@20250929. [3][4]

Notes

  • Check Anthropic/Claude docs for exact API headers, rate limits, and any model-specific migration notes (Sonnet 4.5 migration guide / release notes). [1][3]

Sources
[1] Anthropic model docs (Get a Model).
[2] Anthropic product page (Claude Sonnet 4.5).
[3] Claude docs — "What's new" / availability (lists claude-sonnet-4-5-20250929).
[4] Google Cloud Vertex AI — Claude Sonnet 4.5 partner model page.
[5] Claude API / Messages endpoint example.


🌐 Web query:

Google Gemini gemini-1.5-flash model API

💡 Result:

Summary — gemini-1.5-flash (Google Gemini)

  • Model ID: gemini-1.5-flash. It’s a multimodal text-generation model (text outputs; accepts text, code, images, audio, video, PDFs). [1]
  • Token / context limits: up to 1,048,576 input tokens; default max output ~8,192 tokens. [1]
  • Lifecycle / status: documented as a legacy/deprecated model (Google recommends using Gemini 2.0 Flash or newer) and specific model versions (e.g., gemini-1.5-flash-002) have deprecation/discontinuation dates. Check the model page for exact dates for any version you plan to use. [1]
  • Where to call it:
    • Vertex AI / Google Cloud (Model Garden / Generative AI on Vertex AI). Use Vertex AI REST/SDKs or gcloud for deployment and inference. [1][3]
    • Google announced Gemini access via the OpenAI-compatible Library / REST surface — you can call model="gemini-1.5-flash" through that API (example snippet in the Google developers post). Confirm which endpoint and credentials you must use for your project. [2]
  • Features: multimodal inputs, grounding with Google Search (for supported models/features), tuning (fine-tuning) options were available for 1.5 Flash versions when supported. [1][3]

If you want a short example (OpenAI-compatible) or Vertex AI code snippet for calling gemini-1.5-flash, tell me which environment you’ll use (Vertex AI Python SDK, REST/gcloud, or OpenAI-compatible client) and I’ll paste the minimal working example with the correct endpoint and parameters plus notes about authentication and region.

Sources: Google Cloud model page and release notes; Google Developers post about OpenAI Library access. [1][3][2]


🌐 Web query:

xAI Grok grok-beta model API

💡 Result:

Short summary — xAI "grok-beta" model API

  • Endpoint/base URL: HTTPS REST API at https://api.x.ai/v1. Use your xAI API key from console.x.ai. [1][3]
  • Model name to request: "grok-beta" (early preview model). [1][2]
  • Key capabilities: text-only grok-beta supports system prompts and function-calling; xAI announced a multimodal/vision variant (grok-vision-beta) coming. Context window ~128,000 tokens (announced for grok-beta). [1][2]
  • Compatibility: REST interface designed to be compatible with OpenAI-style SDKs (you can often switch base_url + key). Example: change OpenAI Python SDK base_url to https://api.x.ai/v1. [1]
  • Status/pricing: grok-beta was a public‑beta/early model (xAI later released newer grok-2 family and other models); pricing slabs and newer recommended models (grok-2 series, grok-4, etc.) are listed on xAI’s API/docs pages. Check docs.x.ai or console.x.ai for current availability, deprecation, and exact pricing. [2][3]

If you want, I can:

  • show a minimal curl or Python example calling "grok-beta", or
  • look up the current status/pricing for grok-beta right now. Which would you like?

Consider using more current model versions for Gemini and xAI.

The model names are valid and callable, but note:

  • Google Gemini: gemini-1.5-flash is documented as legacy/deprecated; Google recommends using Gemini 2.0 Flash or newer.
  • xAI: grok-beta is a public-beta early model; xAI has since released newer versions (grok-2 and later). Check docs.x.ai for current recommended models and pricing.
  • OpenAI gpt-4o-mini and Anthropic claude-sonnet-4-5-20250929 are current and supported.

Also applies to: 115-115, 122-123

🤖 Prompt for AI Agents
In src/provider/mod.rs around lines 113, 115 and 122-123, the hardcoded model
identifiers for Google Gemini and xAI are set to legacy/beta names; update those
entries to use the current recommended model versions (e.g., Gemini 2.0 Flash or
the latest Gemini release and xAI grok-2 or the current stable grok model) by
replacing the deprecated model strings with the up-to-date names from the
providers' docs, and ensure any related provider display name or env key remains
correct; verify compilation and update tests or comments to reference the
provider docs/versions used.

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