Skip to content

Commit f937ce0

Browse files
committed
feat: Add GigaChat v2 models and fix /models endpoint for Xcode 26
Currently, the /models endpoint returns only OpenAI models, which causes issues when iOS developers use gpt2giga with Xcode 26's AI assistant integration. When Xcode requests the model list and users select an OpenAI model (like gpt-4), subsequent /completions requests fail because GigaChat API doesn't recognize these model names. Additionally, Xcode 26 sends requests to /models? (with a trailing question mark), which currently returns invalid_request_error due to strict path matching. This PR adds real GigaChat v2 models to the models list and fixes the endpoint handling: - Added GigaChat v2 models: GigaChat-2, GigaChat-2-Max, GigaChat-2-Pro - Fixed /models endpoint: Now handles URLs with query parameters (e.g., /models?) for Xcode 26 compatibility
1 parent aa2e5fa commit f937ce0

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

gpt2giga/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def send_to_gigachat_stream(self, data: dict) -> Iterator[dict]:
362362
yield process_gigachat_stream(chunk, gpt_model, is_tool_call)
363363

364364
def do_GET(self):
365-
if self.path in ("/models", "/v1/models"):
365+
if self.path.startswith(("/models", "/v1/models")):
366366
self.handle_models_request()
367367
else:
368368
self.handle_proxy_chat()

gpt2giga/gpt2giga_models.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
{
22
"object": "list",
33
"data": [
4+
{
5+
"id": "GigaChat-2",
6+
"object": "model",
7+
"created": 1700000001,
8+
"owned_by": "salutedevices"
9+
},
10+
{
11+
"id": "GigaChat-2-Max",
12+
"object": "model",
13+
"created": 1700000002,
14+
"owned_by": "salutedevices"
15+
},
16+
{
17+
"id": "GigaChat-2-Pro",
18+
"object": "model",
19+
"created": 1700000003,
20+
"owned_by": "salutedevices"
21+
},
422
{
523
"id": "gpt-4-turbo",
624
"object": "model",

0 commit comments

Comments
 (0)