fix: use app-chat REST as primary image generation, fallback to ws_imagine#374
Open
JinchengGao-Infty wants to merge 2 commits intochenyme:mainfrom
Open
fix: use app-chat REST as primary image generation, fallback to ws_imagine#374JinchengGao-Infty wants to merge 2 commits intochenyme:mainfrom
JinchengGao-Infty wants to merge 2 commits intochenyme:mainfrom
Conversation
…ck to ws_imagine The WebSocket endpoint `wss://grok.com/ws/imagine/listen` has been deprecated by Grok, causing all image generation requests to fail with `rate_limit_exceeded`. This change: - Adds `_stream_app_chat` and `_collect_app_chat` methods that use the app-chat REST API (via `GrokChatService`) with `imageGen` tool override for image generation - Makes app-chat the primary path for both streaming and non-streaming image generation - Falls back to ws_imagine only when app-chat fails with a non-rate-limit error - Adds `request_overrides` parameter to `GrokChatService.chat()` and `AppChatReverse.build_payload()` to support `imageGenerationCount` and `enableNsfw` - Reuses existing `ImageStreamProcessor` and `ImageCollectProcessor` from image_edit module for processing app-chat image responses Fixes image generation that was broken for all users after Grok deprecated ws_imagine.
…ng, extract markdown images image_edit.py: - Remove VideoService/parentPostId dependency (no longer needed) - Use file_attachments instead of imageEditUri for image upload - Use fixed grok-4 / MODEL_MODE_AUTO for edit upstream - Add image_id to stream events for frontend waterfall compatibility app_chat.py: - Add robust _read_error_body() for non-200 upstream responses - Log content-type and body on failure for better debugging chat.py: - Extract image URLs from markdown syntax in message content - Deduplicate collected image URLs
|
Hurry up and release it, buddy. |
|
Video generation is having the same issue. |
Author
Here's my fork with Docker support, feel free to use it: https://github.com/JinchengGao-Infty/grok2api |
Author
That's a separate issue — free accounts can't generate videos anymore. |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wss://grok.com/ws/imagine/listenhas been deprecated by Grok, causing all image generation requests to fail withrate_limit_exceedederrorsGrokChatServicewithimageGentool override), and keepsws_imagineas a fallbackChanges
app/services/grok/services/image.py_stream_app_chat()and_collect_app_chat()methods for app-chat based image generation_app_chat_request_overrides()helper forimageGenerationCountandenableNsfwgenerate()to try app-chat first, then fallback to ws_imagine on non-rate-limit errorsImageStreamProcessor/ImageCollectProcessorfromimage_editmoduleapp/services/grok/services/chat.pyrequest_overridesparameter toGrokChatService.chat()to pass through custom request fieldsapp/services/reverse/app_chat.pyrequest_overridesparameter tobuild_payload()andrequest()Test plan
/v1/images/generationsendpoint (both stream and non-stream)/v1/chat/completionswith image model