navalmen007 commited on
Commit
e7adbbd
·
verified ·
1 Parent(s): e774c25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -176
app.py CHANGED
@@ -1,13 +1,18 @@
1
  import requests
2
  from flask import Flask, request, Response, jsonify
3
 
 
 
 
4
  app = Flask(__name__)
5
 
 
 
6
  # Authentication headers (this could be made dynamic too)
7
  headers = {
8
  'accept': 'application/json',
9
  'content-type': 'application/json',
10
- 'cookie': 'session=eyJzZXNzaW9uX2lkIjogIjgyMGM2OTJmLTRhMzItNGVhMi05MTNhLTBjNzk1YTYwN2MyMSIsICJ1c2VyX2lkIjogIjA2ODkxMzVhLWRhZTUtNDk0OS05NTE3LWQ3MTJlMmZkZDU4YiJ9.ZykspA.CLUCSuyHoG8S1uruiVKNkHRjw5Q'
11
  }
12
 
13
  # Base URL for proxying the requests
@@ -21,181 +26,44 @@ def hello():
21
  @app.route('/v1/models', methods=['GET','POST'])
22
  def get_models():
23
  models_data = {
24
- "models": {
25
- "groq": [
26
- {
27
- "active": True,
28
- "context_window": 4096,
29
- "created": 1725402373,
30
- "id": "llava-v1.5-7b-4096-preview",
31
- "object": "model",
32
- "owned_by": "Other",
33
- "public_apps": None
34
- },
35
- {
36
- "active": True,
37
- "context_window": 8192,
38
- "created": 1693721698,
39
- "id": "llama3-groq-70b-8192-tool-use-preview",
40
- "object": "model",
41
- "owned_by": "Groq",
42
- "public_apps": None
43
- },
44
- {
45
- "active": True,
46
- "context_window": 8192,
47
- "created": 1727224290,
48
- "id": "llama-3.2-3b-preview",
49
- "object": "model",
50
- "owned_by": "Meta",
51
- "public_apps": None
52
- },
53
- {
54
- "active": True,
55
- "context_window": 8192,
56
- "created": 1727283005,
57
- "id": "llama-3.2-11b-text-preview",
58
- "object": "model",
59
- "owned_by": "Meta",
60
- "public_apps": None
61
- },
62
- {
63
- "active": True,
64
- "context_window": 448,
65
- "created": 1693721698,
66
- "id": "distil-whisper-large-v3-en",
67
- "object": "model",
68
- "owned_by": "Hugging Face",
69
- "public_apps": None
70
- },
71
- {
72
- "active": True,
73
- "context_window": 8192,
74
- "created": 1693721698,
75
- "id": "gemma-7b-it",
76
- "object": "model",
77
- "owned_by": "Google",
78
- "public_apps": None
79
- },
80
- {
81
- "active": True,
82
- "context_window": 8192,
83
- "created": 1727285716,
84
- "id": "llama-3.2-90b-text-preview",
85
- "object": "model",
86
- "owned_by": "Meta",
87
- "public_apps": None
88
- },
89
- {
90
- "active": True,
91
- "context_window": 32768,
92
- "created": 1693721698,
93
- "id": "llama-3.1-70b-versatile",
94
- "object": "model",
95
- "owned_by": "Meta",
96
- "public_apps": None
97
- },
98
- {
99
- "active": True,
100
- "context_window": 8192,
101
- "created": 1727226914,
102
- "id": "llama-3.2-90b-vision-preview",
103
- "object": "model",
104
- "owned_by": "Meta",
105
- "public_apps": None
106
- },
107
- {
108
- "active": True,
109
- "context_window": 8192,
110
- "created": 1693721698,
111
- "id": "llama3-8b-8192",
112
- "object": "model",
113
- "owned_by": "Meta",
114
- "public_apps": None
115
- },
116
- {
117
- "active": True,
118
- "context_window": 8192,
119
- "created": 1727226869,
120
- "id": "llama-3.2-11b-vision-preview",
121
- "object": "model",
122
- "owned_by": "Meta",
123
- "public_apps": None
124
- },
125
- {
126
- "active": True,
127
- "context_window": 8192,
128
- "created": 1727224268,
129
- "id": "llama-3.2-1b-preview",
130
- "object": "model",
131
- "owned_by": "Meta",
132
- "public_apps": None
133
- },
134
- {
135
- "active": True,
136
- "context_window": 131072,
137
- "created": 1693721698,
138
- "id": "llama-3.1-8b-instant",
139
- "object": "model",
140
- "owned_by": "Meta",
141
- "public_apps": None
142
- },
143
- {
144
- "active": True,
145
- "context_window": 8192,
146
- "created": 1693721698,
147
- "id": "llama-guard-3-8b",
148
- "object": "model",
149
- "owned_by": "Meta",
150
- "public_apps": None
151
- },
152
- {
153
- "active": True,
154
- "context_window": 32768,
155
- "created": 1693721698,
156
- "id": "mixtral-8x7b-32768",
157
- "object": "model",
158
- "owned_by": "Mistral AI",
159
- "public_apps": None
160
- },
161
- {
162
- "active": True,
163
- "context_window": 8192,
164
- "created": 1693721698,
165
- "id": "llama3-70b-8192",
166
- "object": "model",
167
- "owned_by": "Meta",
168
- "public_apps": None
169
- },
170
- {
171
- "active": True,
172
- "context_window": 8192,
173
- "created": 1693721698,
174
- "id": "llama3-groq-8b-8192-tool-use-preview",
175
- "object": "model",
176
- "owned_by": "Groq",
177
- "public_apps": None
178
- },
179
- {
180
- "active": True,
181
- "context_window": 8192,
182
- "created": 1693721698,
183
- "id": "gemma2-9b-it",
184
- "object": "model",
185
- "owned_by": "Google",
186
- "public_apps": None
187
- }
188
- ],
189
- "litellm": [],
190
- "ollama": [],
191
- "openai": [
192
- "gpt-3.5-turbo",
193
- "gpt-4o-mini",
194
- "gpt-4o",
195
- "gpt-4-turbo"
196
- ]
197
- }
198
- }
199
 
200
  return jsonify(models_data)
201
 
 
1
  import requests
2
  from flask import Flask, request, Response, jsonify
3
 
4
+ import os
5
+
6
+
7
  app = Flask(__name__)
8
 
9
+ cookie = os.environ.get('COOKIE')
10
+
11
  # Authentication headers (this could be made dynamic too)
12
  headers = {
13
  'accept': 'application/json',
14
  'content-type': 'application/json',
15
+ 'cookie': cookie
16
  }
17
 
18
  # Base URL for proxying the requests
 
26
  @app.route('/v1/models', methods=['GET','POST'])
27
  def get_models():
28
  models_data = {
29
+ "data": [
30
+ {
31
+ "id": "gpt-3.5-turbo",
32
+ "object": "model",
33
+ "created": 1,
34
+ "owned_by": "fresed",
35
+ "token_coefficient": 0.5,
36
+ "max_tokens": 16385
37
+ },
38
+ {
39
+ "id": "gpt-4-turbo",
40
+ "object": "model",
41
+ "created": 1,
42
+ "owned_by": "fresed",
43
+ "vision": true,
44
+ "token_coefficient": 1,
45
+ "max_tokens": 128000
46
+ },
47
+ {
48
+ "id": "gpt-4o",
49
+ "object": "model",
50
+ "created": 1,
51
+ "owned_by": "fresed",
52
+ "vision": true,
53
+ "token_coefficient": 0.9,
54
+ "max_tokens": 128000
55
+ },
56
+ {
57
+ "id": "gpt-4o-mini",
58
+ "object": "model",
59
+ "created": 1,
60
+ "owned_by": "fresed",
61
+ "vision": true,
62
+ "token_coefficient": 0.2,
63
+ "max_tokens": 128000
64
+ }
65
+ ]
66
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  return jsonify(models_data)
69