-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: grok-420 使用新的 modeId API 格式修复 Super 账号空响应 #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -155,14 +155,25 @@ class ModelService: | |||||||||||||||||||||||
| ModelInfo( | ||||||||||||||||||||||||
| model_id="grok-4.20-beta", | ||||||||||||||||||||||||
| grok_model="grok-420", | ||||||||||||||||||||||||
| model_mode="MODEL_MODE_GROK_420", | ||||||||||||||||||||||||
| model_mode="MODEL_MODE_EXPERT", | ||||||||||||||||||||||||
| tier=Tier.BASIC, | ||||||||||||||||||||||||
| cost=Cost.LOW, | ||||||||||||||||||||||||
| cost=Cost.HIGH, | ||||||||||||||||||||||||
| display_name="GROK-4.20-BETA", | ||||||||||||||||||||||||
| is_image=False, | ||||||||||||||||||||||||
| is_image_edit=False, | ||||||||||||||||||||||||
| is_video=False, | ||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||
| ModelInfo( | ||||||||||||||||||||||||
| model_id="grok-4.20-fast", | ||||||||||||||||||||||||
| grok_model="grok-420", | ||||||||||||||||||||||||
| model_mode="MODEL_MODE_FAST", | ||||||||||||||||||||||||
| tier=Tier.BASIC, | ||||||||||||||||||||||||
| cost=Cost.LOW, | ||||||||||||||||||||||||
| display_name="GROK-4.20-FAST", | ||||||||||||||||||||||||
| is_image=False, | ||||||||||||||||||||||||
| is_image_edit=False, | ||||||||||||||||||||||||
| is_video=False, | ||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||
| ModelInfo( | ||||||||||||||||||||||||
|
Comment on lines
+167
to
177
|
||||||||||||||||||||||||
| model_id="grok-4.20-fast", | |
| grok_model="grok-420", | |
| model_mode="MODEL_MODE_FAST", | |
| tier=Tier.BASIC, | |
| cost=Cost.LOW, | |
| display_name="GROK-4.20-FAST", | |
| is_image=False, | |
| is_image_edit=False, | |
| is_video=False, | |
| ), | |
| ModelInfo( |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,13 @@ | |
| CHAT_API = "https://grok.com/rest/app-chat/conversations/new" | ||
| _LAST_PROXY_LOG_STATE: tuple[str, str] | None = None | ||
|
|
||
| # grok-420 使用新的 modeId API 格式(替代 modelName/modelMode) | ||
| # 官方 web 端已将 grok-420 切换为 modeId 字段,旧的 MODEL_MODE_GROK_420 已废弃 | ||
| _GROK420_MODE_ID_MAP = { | ||
| "MODEL_MODE_EXPERT": "expert", | ||
| "MODEL_MODE_FAST": "fast", | ||
| } | ||
|
|
||
|
|
||
| def _normalize_chat_proxy(proxy_url: str) -> str: | ||
| """Normalize proxy URL for curl-cffi app-chat requests.""" | ||
|
|
@@ -114,6 +121,11 @@ def build_payload( | |
| } | ||
|
|
||
| if model == "grok-420": | ||
| # grok-420: 使用新的 modeId 格式,移除旧的 modelName/modelMode | ||
| payload.pop("modelName", None) | ||
| payload.pop("modelMode", None) | ||
| payload["responseMetadata"] = {} | ||
| payload["modeId"] = _GROK420_MODE_ID_MAP.get(mode, "expert") | ||
|
Comment on lines
+124
to
+128
|
||
| payload["enable420"] = True | ||
|
|
||
| custom_personality = AppChatReverse._resolve_custom_personality() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grok-4.20-betais being changed from low-cost to high-cost (cost=Cost.HIGH), which affects usage accounting (effort) and may change the “计次/Cost” users expect. Please update the model tables inreadme.md/docs/README.en.mdso user-facing docs match runtime behavior.