Skip to content

Commit d6c4ebd

Browse files
committed
feat: Add GigaChat v2 models and fix /models endpoint for Xcode 26
## Problem 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. ## Solution 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 d6c4ebd

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ services:
1111
restart: unless-stopped
1212
environment:
1313
PROXY_HOST: 0.0.0.0
14-
GIGACHAT_CREDENTIALS: <your_api_key>
14+
GPT2GIGA_PASS_TOKEN: "True"

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)