Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Latest commit

 

History

History
242 lines (173 loc) · 6.32 KB

File metadata and controls

242 lines (173 loc) · 6.32 KB

Issue #759 - Complete Solution Documentation

Executive Summary

Issue: Users encountering "Requests Error" when using "Gemini-3-Pro-Preview" with Roocode VSCode extension.

Root Cause: Invalid model name - "Gemini-3-Pro-Preview" does not exist.

Solution: Update to valid model name (e.g., gemini-2.0-flash, gemini-1.5-pro, or gemini-1.5-flash).

Status: ✅ Resolved - Configuration issue, not a bug


Quick Fix (30 seconds)

For Roocode users:

  1. Open VSCode Settings (Ctrl+, or Cmd+,)
  2. Search for "Roocode"
  3. Change model name to: gemini-2.0-flash
  4. Save and reload VSCode

Full guide: See ROOCODE_FIX_GUIDE.md


Valid Model Names

✅ Currently Available Models

Model Name Description Use Case
gemini-2.0-flash Newest model, very fast Recommended for most use cases
gemini-1.5-flash Fast and efficient General coding assistance
gemini-1.5-pro Most capable Complex reasoning, analysis
gemini-1.5-flash-latest Auto-updated flash Always use latest flash version
gemini-1.5-pro-latest Auto-updated pro Always use latest pro version

❌ Invalid Model Names (Cause Errors)

  • Gemini-3-Pro-PreviewDoes not exist
  • gemini-3.0 ← Does not exist
  • gemini-3-pro ← Does not exist
  • gpt-4 ← Wrong API (OpenAI, not Google)

Files Created

  1. ROOCODE_FIX_GUIDE.md

    • Quick fix guide for Roocode users
    • Step-by-step instructions
    • Troubleshooting tips
  2. ISSUE_759_RESOLUTION.md

    • Detailed technical analysis
    • Migration guide to new SDK
    • Information for developers
  3. verify_models.py

    • Python script to verify available models
    • Test API connectivity
    • Validate API key

    Usage:

    export GEMINI_API_KEY="your-api-key"
    python verify_models.py

Important Context

This SDK is Deprecated

⚠️ This repository is deprecated and will reach End-of-Life on November 30, 2025.

Please migrate to the new SDK:

Migration Example

Old SDK (deprecated):

import google.generativeai as genai

genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content("Hello")
print(response.text)

New SDK (recommended):

from google import genai

client = genai.Client(api_key="YOUR_API_KEY")
response = client.models.generate_content(
    model="gemini-1.5-flash",
    contents="Hello"
)
print(response.text)

How to Verify Available Models

Using Python

import google.generativeai as genai

genai.configure(api_key="YOUR_API_KEY")

for model in genai.list_models():
    if 'generateContent' in model.supported_generation_methods:
        print(model.name)

Using REST API

curl "https://generativelanguage.googleapis.com/v1beta/models?key=YOUR_API_KEY"

Using Our Verification Script

export GEMINI_API_KEY="your-api-key"
python verify_models.py

For Third-Party Developers

If you're building tools that integrate with Gemini API:

Best Practices

  1. Validate Model Names

    def get_available_models(api_key):
        """Fetch current list of available models from API."""
        response = requests.get(
            f"https://generativelanguage.googleapis.com/v1beta/models?key={api_key}"
        )
        return [model['name'] for model in response.json()['models']
                if 'generateContent' in model.get('supportedGenerationMethods', [])]
  2. Provide Dropdown Instead of Free Text

    • Don't let users type model names
    • Fetch and display valid options
    • Update list periodically
  3. Handle Errors Gracefully

    try:
        response = model.generate_content(prompt)
    except Exception as e:
        if "not found" in str(e).lower():
            return "Invalid model name. Please select from available models."
        elif "unavailable" in str(e).lower():
            return "Service temporarily unavailable. Please try again."
        else:
            return f"Error: {e}"
  4. Use the New SDK

    • Migrate to google-genai package
    • Better long-term support
    • More features and improvements

Resources

Getting Started

Migration & Support

This Repository (Deprecated)


Testing Your Setup

Test 1: Verify API Key

curl "https://generativelanguage.googleapis.com/v1beta/models?key=YOUR_API_KEY"

Test 2: Test Model Access

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"contents":[{"parts":[{"text":"Hello"}]}]}'

Test 3: Run Verification Script

python verify_models.py

Conclusion

This is not a bug in the SDK - it's a configuration issue with an invalid model name in a third-party tool (Roocode).

Solution:

  1. ✅ Update model name to valid option (e.g., gemini-2.0-flash)
  2. ✅ Verify API key is correct
  3. ✅ Consider migrating to new Google Gen AI SDK

For Roocode Users: See ROOCODE_FIX_GUIDE.md

For Developers: See ISSUE_759_RESOLUTION.md


Issue Status: ✅ Resolved
Resolution Type: Configuration Fix
Affected Users: Roocode VSCode extension users
Resolution Date: December 12, 2024