ohmyapi commited on
Commit
ac2df19
·
1 Parent(s): d60b7bc

fix: override /v1/models with correct model list via nginx

Browse files

- Serve static models.json at /v1/models instead of proxying to upstream
- Remove non-existent models (haiku-4-6, 3.5 series)
- Correct thinking variants: opus/sonnet/haiku all have -thinking suffix
- Space remains paused — code-only fix, no runtime deployment

Files changed (3) hide show
  1. Dockerfile +1 -0
  2. nginx.conf +5 -0
  3. static/models.json +61 -0
Dockerfile CHANGED
@@ -5,6 +5,7 @@ FROM nginx:1.27-alpine
5
  COPY --from=upstream /claude2api /usr/local/bin/claude2api
6
  COPY nginx.conf /etc/nginx/conf.d/default.conf
7
  COPY static/index.html /usr/share/nginx/html/index.html
 
8
  COPY entrypoint.sh /entrypoint.sh
9
 
10
  EXPOSE 7860
 
5
  COPY --from=upstream /claude2api /usr/local/bin/claude2api
6
  COPY nginx.conf /etc/nginx/conf.d/default.conf
7
  COPY static/index.html /usr/share/nginx/html/index.html
8
+ COPY static/models.json /usr/share/nginx/html/models.json
9
  COPY entrypoint.sh /entrypoint.sh
10
 
11
  EXPOSE 7860
nginx.conf CHANGED
@@ -25,6 +25,11 @@ server {
25
  return 204;
26
  }
27
 
 
 
 
 
 
28
  location /v1/messages {
29
  proxy_pass http://claude2api_upstream;
30
  proxy_http_version 1.1;
 
25
  return 204;
26
  }
27
 
28
+ location = /v1/models {
29
+ default_type application/json;
30
+ alias /usr/share/nginx/html/models.json;
31
+ }
32
+
33
  location /v1/messages {
34
  proxy_pass http://claude2api_upstream;
35
  proxy_http_version 1.1;
static/models.json ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "object": "list",
3
+ "data": [
4
+ {
5
+ "id": "claude-opus-4-6",
6
+ "object": "model",
7
+ "created": 1735689600,
8
+ "owned_by": "anthropic",
9
+ "display_name": "Claude Opus 4.6"
10
+ },
11
+ {
12
+ "id": "claude-sonnet-4-6",
13
+ "object": "model",
14
+ "created": 1735689600,
15
+ "owned_by": "anthropic",
16
+ "display_name": "Claude Sonnet 4.6"
17
+ },
18
+ {
19
+ "id": "claude-sonnet-4-5-20250929",
20
+ "object": "model",
21
+ "created": 1727568000,
22
+ "owned_by": "anthropic",
23
+ "display_name": "Claude Sonnet 4.5"
24
+ },
25
+ {
26
+ "id": "claude-haiku-4-5-20251001",
27
+ "object": "model",
28
+ "created": 1727740800,
29
+ "owned_by": "anthropic",
30
+ "display_name": "Claude Haiku 4.5"
31
+ },
32
+ {
33
+ "id": "claude-opus-4-6-thinking",
34
+ "object": "model",
35
+ "created": 1735689600,
36
+ "owned_by": "anthropic",
37
+ "display_name": "Claude Opus 4.6 (Extended Thinking)"
38
+ },
39
+ {
40
+ "id": "claude-sonnet-4-6-thinking",
41
+ "object": "model",
42
+ "created": 1735689600,
43
+ "owned_by": "anthropic",
44
+ "display_name": "Claude Sonnet 4.6 (Extended Thinking)"
45
+ },
46
+ {
47
+ "id": "claude-sonnet-4-5-20250929-thinking",
48
+ "object": "model",
49
+ "created": 1727568000,
50
+ "owned_by": "anthropic",
51
+ "display_name": "Claude Sonnet 4.5 (Extended Thinking)"
52
+ },
53
+ {
54
+ "id": "claude-haiku-4-5-20251001-thinking",
55
+ "object": "model",
56
+ "created": 1727740800,
57
+ "owned_by": "anthropic",
58
+ "display_name": "Claude Haiku 4.5 (Extended Thinking)"
59
+ }
60
+ ]
61
+ }