refactor: update providers list, env vars, and minor fixes

- **example.env**:
  - Added `G4F_API_KEY` and `G4F_PROXY` variables
  - Removed Azure-related API keys and routes block
  - Added `OLLAMA_API_KEY`, `NVIDIA_API_KEY`, and `PUTER_API_KEY`

- **g4f/Provider/EasyChat.py**:
  - Replaced `page.js_dumps` with `page.evaluate` for retrieving `guestId`

- **g4f/Provider/deprecated/LegacyLMArena.py**:
  - Changed `working = True` to `working = False`

- **g4f/Provider/deprecated/har/__init__.py**:
  - Changed `working = True` to `working = False`

- **g4f/providers/any_provider.py**:
  - Updated imports, adding `Custom`, `PollinationsImage`, `OpenaiAccount`, and reordering providers
  - Renamed `PROVIERS_LIST_2` → `PROVIDERS_LIST_2` and `PROVIERS_LIST_3` → `PROVIDERS_LIST_3`
  - Removed `PROVIERS_LIST_1` and replaced its usage with `Provider.__providers__`
  - Changed `cls.audio_models` initialization from `{}` to `[]`
  - Adjusted handling of model mapping with `clean_name` for consistency
  - GeminiPro check updated to `if provider == GeminiPro`
  - Changed final `cls.audio_models` assignment to `[ *cls.audio_models ]` instead of `list(cls.audio_models.keys())`
  - Adjusted provider fallback in `AnyProvider` to use `PROVIDERS_LIST_2 + PROVIDERS_LIST_3`

- **g4f/requests/__init__.py**:
  - Changed SSE parsing condition from `line.startswith(b"data: ")` to `line.startswith(b"data:")`
  - Updated slice from `line[6:]` to `line[5:]` when extracting `rest
This commit is contained in:
hlohaus 2025-08-18 17:44:05 +02:00
parent b6bf9ee62c
commit 05f0f55711
6 changed files with 29 additions and 49 deletions

View file

@ -1,6 +1,9 @@
# Rename this file to .env and copy it to your cookies directory
# Update the API_KEY and other variables as needed
G4F_API_KEY=
G4F_PROXY=
HUUGINGFACE_API_KEY=
POLLINATIONS_API_KEY=
GEMINI_API_KEY=
@ -9,19 +12,6 @@ DEEPINFRA_API_KEY=
OPENAI_API_KEY=
GROQ_API_KEY=
OPENROUTER_API_KEY=
AZURE_API_KEYS='{
"default": "",
"flux-1.1-pro": "",
"flux.1-kontext-pro": ""
}'
AZURE_DEFAULT_MODEL="model-router"
AZURE_ROUTES='{
"model-router": "https://HOST.cognitiveservices.azure.com/openai/deployments/model-router/chat/completions?api-version=2025-01-01-preview",
"deepseek-r1": "https://HOST.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview",
"gpt-4.1": "https://HOST.cognitiveservices.azure.com/openai/deployments/gpt-4.1/chat/completions?api-version=2025-01-01-preview",
"gpt-4o-mini-audio-preview": "https://HOST.cognitiveservices.azure.com/openai/deployments/gpt-4o-mini-audio-preview/chat/completions?api-version=2025-01-01-preview",
"o4-mini": "https://HOST.cognitiveservices.azure.com/openai/deployments/o4-mini/chat/completions?api-version=2025-01-01-preview",
"grok-3": "https://HOST.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview",
"flux-1.1-pro": "https://HOST.cognitiveservices.azure.com/openai/deployments/FLUX-1.1-pro/images/generations?api-version=2025-04-01-preview",
"flux.1-kontext-pro": "https://HOST.services.ai.azure.com/openai/deployments/FLUX.1-Kontext-pro/images/edits?api-version=2025-04-01-preview"
}'
OLLAMA_API_KEY=
NVIDIA_API_KEY=
PUTER_API_KEY=