- **g4f/Provider/har/__init__.py**
- `get_models`/`create_async`: iterate over `(domain, harFile)` and filter with `domain in request_url`
- `read_har_files` now yields `(domain, har_data)`; fixes file variable shadowing and uses `json.load`
- remove stray `print`, add type hint for `find_str`, replace manual loops with `yield from`
- small whitespace clean-up
- **g4f/Provider/needs_auth/Grok.py**
- `ImagePreview` now passes `auth_result.cookies` and `auth_result.headers`
- **g4f/Provider/needs_auth/OpenaiChat.py**
- add `Union` import; rename/refactor `get_generated_images` → `get_generated_image`
- support `file-service://` and `sediment://` pointers; choose correct download URL
- return `ImagePreview` or `ImageResponse` accordingly and stream each image part
- propagate 422 errors, update prompt assignment and image handling paths
- **g4f/client/__init__.py**
- drop unused `ignore_working` parameter in sync/async `Completions`
- normalise `media` argument: accept single tuple, infer filename when missing, fix index loop
- `Images.create_variation` updated to use the new media logic
- **g4f/gui/server/api.py**
- expose `latest_version_cached` via `?cache=` query parameter
- **g4f/gui/server/backend_api.py**
- optional Markdown extraction via `MarkItDown`; save rendered text as `<file>.md`
- upload flow rewrites: copy to temp file, move to bucket/media dir, clean temp, store filenames
- introduce `has_markitdown` guard and improved logging/exception handling
- **g4f/tools/files.py**
- remove trailing spaces in HAR code-block header string
- **g4f/version.py**
- add `latest_version_cached` `@cached_property` for memoised version lookup
- Updated `PollinationsAI` to exclude "gemini" model from `audio_models`
- Added logic in `PollinationsAI` to expand `audio_models` with voices from `default_audio_model`
- Appended voice names to `text_models` list in `PollinationsAI` if present in `default_audio_model`
- Modified `PollinationsAI._generate_text` to inject `audio` parameters when a voice model is used
- Updated `save_response_media` call to include voice name in model list
- Changed `OpenaiChat.get_generated_image` to support both `file-service://` and `sediment://` URLs using `conversation_id`
- Modified `OpenaiChat.create_messages` to optionally pass `prompt`
- Adjusted `OpenaiChat.run` to determine `prompt` explicitly and set messages accordingly
- Updated `OpenaiChat.iter_messages_line` to handle `None` in `fields.p` safely
- Passed `prompt` and `conversation_id` to `OpenaiChat.get_generated_image` inside image parsing loop
- Fixed redirect logic in `backend_api.py` to safely handle missing `skip` query param
- Enhanced `render` function in `website.py` to support live file serving with `live` query param
- Added new route `/dist/<path:name>` to serve static files from `DIST_DIR` in `website.py`
- Adjusted `render` to include `.live` suffix in cache filename when applicable
- Modified HTML replacements in `render` to preserve local `dist/` path if `add_origion` is True
docs: update media examples and add parameter details for TTS providers
- Updated EdgeTTS example to mention additional audio parameters (`rate`, `volume`, `pitch`)
- Updated gTTS example to include support for `tld` and `slow` audio parameters
- Modified the EdgeTTS provider to use `get_last_message` instead of `format_image_prompt` for prompt handling
- Modified the gTTS provider to use `get_last_message` instead of `format_image_prompt` for prompt handling
- Refactored audio file generation logic in the gTTS provider to handle `language` parameter and update the voice model accordingly
- Refactored backend API code to introduce `cast_str` function for processing responses, including cache management and response formatting
- Fixed a bug in `AnyProvider` where the model string check would fail if the model was `None`
- Added check in `to_string` helper function to handle `None` values correctly
```
* feat: introduce AnyProvider & LM Arena, overhaul model/provider logic
- **Provider additions & removals**
- Added `Provider/LMArenaProvider.py` with full async stream implementation and vision model support
- Registered `LMArenaProvider` in `Provider/__init__.py`; removed old `hf_space/LMArenaProvider.py`
- Created `providers/any_provider.py`; registers `AnyProvider` dynamically in `Provider`
- **Provider framework enhancements**
- `providers/base_provider.py`
- Added `video_models` and `audio_models` attributes
- `providers/retry_provider.py`
- Introduced `is_content()` helper; now treats `AudioResponse` as stream content
- **Cloudflare provider refactor**
- `Provider/Cloudflare.py`
- Re‑implemented `get_models()` with `read_models()` helper, `fallback_models`, robust nodriver/curl handling and model‑name cleaning
- **Other provider tweaks**
- `Provider/Copilot.py` – removed `"reasoning"` alias and initial `setOptions` WS message
- `Provider/PollinationsAI.py` & `PollinationsImage.py`
- Converted `audio_models` from list to dict, adjusted usage checks and labels
- `Provider/hf/__init__.py` – applies `model_aliases` remap before dispatch
- `Provider/hf_space/DeepseekAI_JanusPro7b.py` – now merges media before upload
- `needs_auth/Gemini.py` – dropped obsolete Gemini model entries
- `needs_auth/GigaChat.py` – added lowercase `"gigachat"` alias
- **API & client updates**
- Replaced `ProviderUtils` with new `Provider` map usage throughout API and GUI server
- Integrated `AnyProvider` as default fallback in `g4f/client` sync & async flows
- API endpoints now return counts of providers per model and filter by `x_ignored` header
- **GUI improvements**
- Updated JS labels with emoji icons, provider ignore logic, model count display
- **Model registry**
- Renamed base model `"GigaChat:latest"` ➜ `"gigachat"` in `models.py`
- **Miscellaneous**
- Added audio/video flags to GUI provider list
- Tightened error propagation in `retry_provider.raise_exceptions`
* Fix unittests
* fix: handle None conversation when accessing provider-specific data
- Modified `AnyProvider` class in `g4f/providers/any_provider.py`
- Updated logic to check if `conversation` is not None before accessing `provider.__name__` attribute
- Wrapped `getattr(conversation, provider.__name__, None)` block in an additional `if conversation is not None` condition
- Changed `setattr(conversation, provider.__name__, chunk)` to use `chunk.get_dict()` instead of the object directly
- Ensured consistent use of `JsonConversation` when modifying or assigning `conversation` data
* ```
feat: add provider string conversion & update IterListProvider call
- In g4f/client/__init__.py, within both Completions and AsyncCompletions, added a check to convert the provider from a string using convert_to_provider(provider) when applicable.
- In g4f/providers/any_provider.py, removed the second argument (False) from the IterListProvider constructor call in the async for loop.
```
---------
Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>
- **g4f/providers/helper.py**
- Add `render_messages()` to normalise message contents that are lists of blocks.
- **g4f/Provider/Blackbox.py**
- Import `get_har_files` and `render_messages`.
- Replace manual walk of `get_cookies_dir()` with `get_har_files()` in `_find_session_in_har`.
- Simplify session‑parsing loop and exception logging; drop permissions check.
- Build `current_messages` with `render_messages(messages)` instead of raw list.
- **g4f/Provider/Cloudflare.py**
- Swap `to_string` import for `render_messages`.
- Add `"impersonate": "chrome"` to default `_args`.
- Construct `data["messages"]` with `render_messages(messages)` and inline `"parts"`; remove `to_string()` calls.
- Move `cache_file` write outside inner `try` to always save arguments.
- **g4f/Provider/Copilot.py**
- Defer `yield conversation` until after `conversation` is created when `return_conversation` is requested.
- **g4f/Provider/openai/har_file.py**
- Break out of `os.walk` after first directory in `get_har_files()` to avoid deep traversal.
- **g4f/api/__init__.py**
- Use `config.conversation` directly and set `return_conversation` when present.
- **g4f/client/__init__.py**
- Pass `conversation` to both `ChatCompletionChunk.model_construct()` and `ChatCompletion.model_construct()`.
- **g4f/client/stubs.py**
- Import `field_serializer` (with stub fallback).
- Add serializers for `conversation` (objects and dicts) and for `content` fields.
- Extend model constructors to accept/propagate `conversation`.
- **g4f/cookies.py**
- Insert ".huggingface.co" into `DOMAINS` list.
- Stop recursive directory walk in `read_cookie_files()` with early `break`.
- **g4f/gui/client/background.html**
- Reorder error‑handling branches; reset `errorImage` in `onload`.
- Revise `skipRefresh` logic and random image URL building.
- **g4f/gui/server/backend_api.py**
- Add `self.match_files` cache for repeated image searches.
- Use `safe_search` for sanitised term matching and `min` comparison.
- Limit walk to one directory level; support deterministic random selection via `random` query param.
- **Miscellaneous**
- Update imports where `render_messages` replaces `to_string`.
- Ensure all modified providers iterate messages through `render_messages` for consistent formatting.
- Added "No auth / HAR file" authentication type in providers-and-models.md
- Added "Video generation" column to provider tables for future capability
- Updated model counts and provider capabilities throughout documentation
- Fixed ARTA provider with improved error handling and response validation
- Enhanced AllenAI provider with vision model support and proper image handling
- Significantly improved Blackbox provider:
- Added HAR file authentication support
- Added subscription status checking
- Added premium/demo model differentiation
- Improved session handling and error recovery
- Enhanced DDG provider with better error handling for challenges
- Improved PollinationsAI and PollinationsImage providers' model handling
- Added VideoModel class in g4f/models.py
- Added audio/video generation indicators in GUI components
- Added new Ai2 models: olmo-1-7b, olmo-2-32b, olmo-4-synthetic
- Added new commit message generation tool in etc/tool/commit.py
Add Reasoning to OpenaiChat provider
Check for pipeline_tag in HuggingChat providers
Add image preview in PollinationsAI
Add input of custom Model in GUI
Add orginal url to downloaded image
Support ssl argument in StreamSession
Report Provider and Errors in RetryProvider
Support ssl argument in OpenaiTemplate
Remove model duplication in OpenaiChat
Disable ChatGpt provider and remove it from models.py
Update slim requirements
Support provider names as model name in Image generation
Add model qwen-2.5-1m-demo to models.py
Stop recognition in UI on enter request
Fix Ratelimt for Ping in GUI
Use OpenaiTemplate for OIVSCode
Support Reasoning in Blackbox
Add error reporting in UI
Support Custom Provider in Demo
Updates for memory with mem0
Fix asyncio import in nodriver function
Add provider specific api endpoints
Support for open settings in UI at /chat/settings
Update demo model list
Disable upload cookies in demo
Track usage in demo mode
Add messages without asking the ai
Add hint for browser usage in provider list
Add qwen2 prompt template to HuggingFace provider
Trim automatic messages in HuggingFaceAPI
Restore browser instance on start up errors in nodriver
Restored instances can be used as usual or to stop the browser
Add demo modus to web ui for HuggingSpace
Add rate limit support to web ui. Simply install flask_limiter
Add home for demo with Access Token input and validation
Add stripped model list for demo
Add ignores for encoding error in web_search and file upload
Improve model list in HuggingSpace, PollinationsAI
Fix Image Generation in PollinationsAI
Add Image Upload in PollinationsAI
Support Usage, FinishReason, jsonMode in PollinationsAI
Add Reasoning to Web UI
Fix using provider api_keys in Web UI
Add "Custom Provider": Set API Url in the settings
Remove Discord link from result, add them to attr: Jmuz
Fix Bug: File content are added to the prompt
Changed response from /v1/models API
Disable Pizzagpt Provider