Spaces:
Running
Running
| """ | |
| Configuration constants for the Geminicli2api proxy server. | |
| Centralizes all configuration to avoid duplication across modules. | |
| """ | |
| import os | |
| # API Endpoints | |
| CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com" | |
| # Client Configuration | |
| CLI_VERSION = "0.1.5" # Match current gemini-cli version | |
| # OAuth Configuration | |
| CLIENT_ID = "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com" | |
| CLIENT_SECRET = "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" | |
| SCOPES = [ | |
| "https://www.googleapis.com/auth/cloud-platform", | |
| "https://www.googleapis.com/auth/userinfo.email", | |
| "https://www.googleapis.com/auth/userinfo.profile", | |
| ] | |
| # File Paths | |
| SCRIPT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| CREDENTIAL_FILE = os.path.join(SCRIPT_DIR, "oauth_creds.json") | |
| # Authentication | |
| GEMINI_AUTH_PASSWORD = os.getenv("GEMINI_AUTH_PASSWORD", "123456") | |
| # Default Safety Settings for Google API | |
| DEFAULT_SAFETY_SETTINGS = [ | |
| {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE"}, | |
| {"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_NONE"}, | |
| {"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_NONE"}, | |
| {"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_NONE"}, | |
| {"category": "HARM_CATEGORY_CIVIC_INTEGRITY", "threshold": "BLOCK_NONE"} | |
| ] | |
| # Supported Models (for /v1beta/models endpoint) | |
| SUPPORTED_MODELS = [ | |
| { | |
| "name": "models/gemini-1.5-pro", | |
| "version": "001", | |
| "displayName": "Gemini 1.5 Pro", | |
| "description": "Mid-size multimodal model that supports up to 2 million tokens", | |
| "inputTokenLimit": 2097152, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-1.5-flash", | |
| "version": "001", | |
| "displayName": "Gemini 1.5 Flash", | |
| "description": "Fast and versatile multimodal model for scaling across diverse tasks", | |
| "inputTokenLimit": 1048576, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-2.5-pro-preview-05-06", | |
| "version": "001", | |
| "displayName": "Gemini 2.5 Pro Preview 05-06", | |
| "description": "Preview version of Gemini 2.5 Pro from May 6th", | |
| "inputTokenLimit": 1048576, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-2.5-pro-preview-06-05", | |
| "version": "001", | |
| "displayName": "Gemini 2.5 Pro Preview 06-05", | |
| "description": "Preview version of Gemini 2.5 Pro from June 5th", | |
| "inputTokenLimit": 1048576, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-2.5-pro", | |
| "version": "001", | |
| "displayName": "Gemini 2.5 Pro", | |
| "description": "Advanced multimodal model with enhanced capabilities", | |
| "inputTokenLimit": 1048576, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-2.5-flash-preview-05-20", | |
| "version": "001", | |
| "displayName": "Gemini 2.5 Flash Preview 05-20", | |
| "description": "Preview version of Gemini 2.5 Flash from May 20th", | |
| "inputTokenLimit": 1048576, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-2.5-flash", | |
| "version": "001", | |
| "displayName": "Gemini 2.5 Flash", | |
| "description": "Fast and efficient multimodal model with latest improvements", | |
| "inputTokenLimit": 1048576, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-2.0-flash", | |
| "version": "001", | |
| "displayName": "Gemini 2.0 Flash", | |
| "description": "Latest generation fast multimodal model", | |
| "inputTokenLimit": 1048576, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-2.0-flash-preview-image-generation", | |
| "version": "001", | |
| "displayName": "Gemini 2.0 Flash Preview Image Generation", | |
| "description": "Preview version with image generation capabilities", | |
| "inputTokenLimit": 32000, | |
| "outputTokenLimit": 8192, | |
| "supportedGenerationMethods": ["generateContent", "streamGenerateContent"], | |
| "temperature": 1.0, | |
| "maxTemperature": 2.0, | |
| "topP": 0.95, | |
| "topK": 64 | |
| }, | |
| { | |
| "name": "models/gemini-embedding-001", | |
| "version": "001", | |
| "displayName": "Gemini Embedding 001", | |
| "description": "Text embedding model for semantic similarity and search", | |
| "inputTokenLimit": 2048, | |
| "outputTokenLimit": 1, | |
| "supportedGenerationMethods": ["embedContent"], | |
| "temperature": 0.0, | |
| "maxTemperature": 0.0, | |
| "topP": 1.0, | |
| "topK": 1 | |
| } | |
| ] |