adaptive-memory-multi-model-router 2.13.18 → 2.13.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +82 -0
- package/.env.example +303 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +83 -12
- package/.github/ISSUE_TEMPLATE/config.yml +12 -6
- package/.github/ISSUE_TEMPLATE/feature_request.md +61 -10
- package/.github/PULL_REQUEST_TEMPLATE.md +53 -26
- package/.github/dependabot.yml +9 -0
- package/.github/workflows/codeql.yml +38 -0
- package/.github/workflows/npm-publish.yml +20 -0
- package/.github/workflows/stale.yml +56 -0
- package/ARCHITECTURE.md +346 -0
- package/AUDIT_REPORT.md +28 -0
- package/CHANGELOG.md +386 -22
- package/CONTRIBUTORS.md +20 -0
- package/Dockerfile +53 -0
- package/Dockerfile.proxy +33 -0
- package/PR_STATUS_REPORT.md +148 -0
- package/README.md +22 -0
- package/RUNKIT.md +83 -0
- package/_schema.html +61 -15
- package/articles/AI_AGENT_LLM_ROUTING.md +150 -0
- package/articles/FROM_ZERO_TO_10K.md +107 -0
- package/articles/LLM_BENCHMARK_DEEP_DIVE.md +153 -0
- package/articles/TWEETS_10K_DOWNLOADS.md +47 -0
- package/articles/TWEETS_BENCHMARK_FIRST.md +46 -0
- package/articles/TWEETS_MCP_PLAY.md +51 -0
- package/articles/TWEETS_SEQUENTIAL_BROKEN.md +49 -0
- package/articles/TWEETS_WHY_BUILD.md +54 -0
- package/benchmark-results.json +26 -45
- package/cli/a3m +840 -0
- package/demo/package.json +13 -0
- package/demo/public/index.html +762 -0
- package/demo/server.js +405 -0
- package/dist/cli.js +4 -0
- package/docker-compose.yml +74 -0
- package/docs/.nojekyll +0 -0
- package/docs/BENCHMARK.md +96 -22
- package/docs/_config.yml +49 -0
- package/docs/api.html +513 -0
- package/docs/benchmark.html +387 -0
- package/docs/cli-cheatsheet.md +339 -0
- package/docs/comparison.md +108 -0
- package/docs/curl-examples.md +247 -0
- package/docs/index.html +390 -99
- package/docs/openapi.yaml +1318 -0
- package/docs/quick-start.html +366 -0
- package/docs/robots.txt +1 -1
- package/docs/sitemap.xml +23 -5
- package/docs/styles.css +682 -0
- package/examples/README.md +61 -0
- package/examples/a3m-sdk.js +124 -0
- package/examples/basic-route.js +54 -0
- package/examples/chat-loop.js +202 -0
- package/examples/classify-then-route.js +102 -0
- package/examples/cost-compare.js +120 -0
- package/examples/ensemble.js +160 -0
- package/integrations/langchain/README.md +216 -0
- package/integrations/langchain/a3m_langchain.ts +1360 -0
- package/integrations/langchain/example.ts +287 -0
- package/integrations/vercel-ai-sdk/README.md +49 -0
- package/integrations/vercel-ai-sdk/a3m_provider.ts +78 -0
- package/integrations/vercel-ai-sdk/example.ts +25 -0
- package/llms-full.txt +43 -0
- package/llms.txt +9 -0
- package/mcp-server/README.md +188 -0
- package/mcp-server/package.json +29 -0
- package/mcp-server/src/index.ts +744 -0
- package/mcp-server/tsconfig.json +19 -0
- package/package.json +3 -3
- package/proxy/README.md +227 -0
- package/proxy/package-lock.json +831 -0
- package/proxy/package.json +17 -0
- package/proxy/rate-limit.js +145 -0
- package/proxy/rate-limit.test.js +311 -0
- package/proxy/server.js +970 -0
- package/scripts/banner.js +29 -0
- package/scripts/compare-providers.sh +230 -0
- package/scripts/cross_post.py +443 -0
- package/scripts/publish_fcc.py +106 -0
- package/scripts/push-to-gitee.sh +52 -0
- package/src/tui/dashboard.ts +13 -0
- package/tests/__mocks__/tokenUtils.ts +22 -0
- package/tests/memory/episodicMemory.test.ts +227 -0
- package/tests/package-lock.json +1628 -0
- package/tests/package.json +18 -0
- package/tests/routing/ensembleVoting.test.ts +236 -0
- package/tests/routing/providerRetry.test.ts +360 -0
- package/tests/routing/queryTypePresets.test.ts +206 -0
- package/tests/tsconfig.json +21 -0
- package/tests/vitest.config.ts +18 -0
- package/.env +0 -2
|
@@ -0,0 +1,1318 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: A3M Router API
|
|
4
|
+
description: |
|
|
5
|
+
Open-source AI gateway that routes queries across 47+ LLM providers
|
|
6
|
+
with intelligent model selection. Unique differentiator: parallel
|
|
7
|
+
multi-LLM execution with ensemble voting (no competitor does this —
|
|
8
|
+
everyone does sequential fallback).
|
|
9
|
+
|
|
10
|
+
Key features:
|
|
11
|
+
- OpenAI-compatible proxy server (drop-in for any OpenAI SDK)
|
|
12
|
+
- Intelligent routing by query complexity, domain, cost constraints
|
|
13
|
+
- Parallel ensemble execution across multiple providers
|
|
14
|
+
- 47+ baked-in provider definitions (free, cheap, mid, premium, enterprise)
|
|
15
|
+
- Semantic caching, guardrails, cost tracking, observability
|
|
16
|
+
- TUI dashboard, CLI, MCP server, LangChain adapter
|
|
17
|
+
|
|
18
|
+
Version 2.14.0 — 19.5 KB, zero ML dependencies.
|
|
19
|
+
version: 2.14.0
|
|
20
|
+
contact:
|
|
21
|
+
name: GitHub
|
|
22
|
+
url: https://github.com/Das-rebel/a3m-router
|
|
23
|
+
license:
|
|
24
|
+
name: MIT
|
|
25
|
+
url: https://opensource.org/licenses/MIT
|
|
26
|
+
|
|
27
|
+
servers:
|
|
28
|
+
- url: http://localhost:8787
|
|
29
|
+
description: Local proxy server (default port, can be overridden via PORT env)
|
|
30
|
+
- url: https://api.a3m-router.dev
|
|
31
|
+
description: Production deployment (self-hosted)
|
|
32
|
+
|
|
33
|
+
paths:
|
|
34
|
+
# ============================================================
|
|
35
|
+
# CHAT COMPLETIONS
|
|
36
|
+
# ============================================================
|
|
37
|
+
/v1/chat/completions:
|
|
38
|
+
post:
|
|
39
|
+
summary: Create a routed chat completion
|
|
40
|
+
description: |
|
|
41
|
+
OpenAI-compatible chat completions endpoint. Accepts standard OpenAI
|
|
42
|
+
request format. Set model="auto" for intelligent routing, or use
|
|
43
|
+
"provider/model" format (e.g., "groq/llama-3.3-70b-versatile") to
|
|
44
|
+
pin a specific provider.
|
|
45
|
+
|
|
46
|
+
Supports both streaming (SSE) and non-streaming responses. When the
|
|
47
|
+
primary provider fails, automatically falls back through alternative
|
|
48
|
+
configured providers.
|
|
49
|
+
operationId: createChatCompletion
|
|
50
|
+
tags:
|
|
51
|
+
- Completions
|
|
52
|
+
requestBody:
|
|
53
|
+
required: true
|
|
54
|
+
content:
|
|
55
|
+
application/json:
|
|
56
|
+
schema:
|
|
57
|
+
type: object
|
|
58
|
+
required:
|
|
59
|
+
- messages
|
|
60
|
+
properties:
|
|
61
|
+
model:
|
|
62
|
+
type: string
|
|
63
|
+
default: auto
|
|
64
|
+
description: |
|
|
65
|
+
Model or routing mode to use.
|
|
66
|
+
|
|
67
|
+
Special routing values:
|
|
68
|
+
- "auto" — Route based on query complexity (recommended)
|
|
69
|
+
- "free" — Route to free tier only
|
|
70
|
+
- "cheap" — Route to cheap tier only
|
|
71
|
+
|
|
72
|
+
Specific model formats:
|
|
73
|
+
- "provider/model" (e.g., "groq/llama-3.3-70b-versatile")
|
|
74
|
+
- Standard model names map to configured providers
|
|
75
|
+
(e.g., "gpt-4o", "claude-sonnet")
|
|
76
|
+
example: auto
|
|
77
|
+
messages:
|
|
78
|
+
type: array
|
|
79
|
+
description: Array of message objects in OpenAI format
|
|
80
|
+
minItems: 1
|
|
81
|
+
items:
|
|
82
|
+
type: object
|
|
83
|
+
required:
|
|
84
|
+
- role
|
|
85
|
+
- content
|
|
86
|
+
properties:
|
|
87
|
+
role:
|
|
88
|
+
type: string
|
|
89
|
+
enum:
|
|
90
|
+
- system
|
|
91
|
+
- user
|
|
92
|
+
- assistant
|
|
93
|
+
- tool
|
|
94
|
+
description: Message role
|
|
95
|
+
content:
|
|
96
|
+
type: string
|
|
97
|
+
description: Message content
|
|
98
|
+
temperature:
|
|
99
|
+
type: number
|
|
100
|
+
default: null
|
|
101
|
+
description: Sampling temperature (0–2). Provider default if unset.
|
|
102
|
+
minimum: 0
|
|
103
|
+
maximum: 2
|
|
104
|
+
max_tokens:
|
|
105
|
+
type: integer
|
|
106
|
+
default: 1024
|
|
107
|
+
description: Maximum tokens to generate
|
|
108
|
+
minimum: 1
|
|
109
|
+
stream:
|
|
110
|
+
type: boolean
|
|
111
|
+
default: false
|
|
112
|
+
description: |
|
|
113
|
+
If true, send SSE stream of partial completions. Token-by-token
|
|
114
|
+
deltas in OpenAI chat.completion.chunk format.
|
|
115
|
+
top_p:
|
|
116
|
+
type: number
|
|
117
|
+
description: Nucleus sampling parameter
|
|
118
|
+
minimum: 0
|
|
119
|
+
maximum: 1
|
|
120
|
+
frequency_penalty:
|
|
121
|
+
type: number
|
|
122
|
+
description: Frequency penalty (-2 to 2)
|
|
123
|
+
minimum: -2
|
|
124
|
+
maximum: 2
|
|
125
|
+
presence_penalty:
|
|
126
|
+
type: number
|
|
127
|
+
description: Presence penalty (-2 to 2)
|
|
128
|
+
minimum: -2
|
|
129
|
+
maximum: 2
|
|
130
|
+
stop:
|
|
131
|
+
oneOf:
|
|
132
|
+
- type: string
|
|
133
|
+
- type: array
|
|
134
|
+
items:
|
|
135
|
+
type: string
|
|
136
|
+
description: Stop sequence(s)
|
|
137
|
+
n:
|
|
138
|
+
type: integer
|
|
139
|
+
default: 1
|
|
140
|
+
description: Number of completions to generate
|
|
141
|
+
example:
|
|
142
|
+
model: auto
|
|
143
|
+
messages:
|
|
144
|
+
- role: system
|
|
145
|
+
content: You are a helpful assistant.
|
|
146
|
+
- role: user
|
|
147
|
+
content: Write a haiku about Kubernetes
|
|
148
|
+
temperature: 0.7
|
|
149
|
+
max_tokens: 256
|
|
150
|
+
stream: false
|
|
151
|
+
responses:
|
|
152
|
+
"200":
|
|
153
|
+
description: Successful completion (non-streaming)
|
|
154
|
+
content:
|
|
155
|
+
application/json:
|
|
156
|
+
schema:
|
|
157
|
+
type: object
|
|
158
|
+
properties:
|
|
159
|
+
id:
|
|
160
|
+
type: string
|
|
161
|
+
description: Unique completion ID
|
|
162
|
+
example: chatcmpl-a1b2c3d4
|
|
163
|
+
object:
|
|
164
|
+
type: string
|
|
165
|
+
default: chat.completion
|
|
166
|
+
created:
|
|
167
|
+
type: integer
|
|
168
|
+
description: Unix timestamp
|
|
169
|
+
model:
|
|
170
|
+
type: string
|
|
171
|
+
description: Actual model used (resolved via routing)
|
|
172
|
+
example: llama-3.3-70b-versatile
|
|
173
|
+
choices:
|
|
174
|
+
type: array
|
|
175
|
+
items:
|
|
176
|
+
type: object
|
|
177
|
+
properties:
|
|
178
|
+
index:
|
|
179
|
+
type: integer
|
|
180
|
+
message:
|
|
181
|
+
type: object
|
|
182
|
+
properties:
|
|
183
|
+
role:
|
|
184
|
+
type: string
|
|
185
|
+
example: assistant
|
|
186
|
+
content:
|
|
187
|
+
type: string
|
|
188
|
+
example: "Pods drift through the cloud\nOrchestrator hums softly\nContainers at rest"
|
|
189
|
+
finish_reason:
|
|
190
|
+
type: string
|
|
191
|
+
example: stop
|
|
192
|
+
usage:
|
|
193
|
+
type: object
|
|
194
|
+
properties:
|
|
195
|
+
prompt_tokens:
|
|
196
|
+
type: integer
|
|
197
|
+
completion_tokens:
|
|
198
|
+
type: integer
|
|
199
|
+
total_tokens:
|
|
200
|
+
type: integer
|
|
201
|
+
example:
|
|
202
|
+
id: chatcmpl-a1b2c3d4e5f
|
|
203
|
+
object: chat.completion
|
|
204
|
+
created: 1716000000
|
|
205
|
+
model: llama-3.3-70b-versatile
|
|
206
|
+
choices:
|
|
207
|
+
- index: 0
|
|
208
|
+
message:
|
|
209
|
+
role: assistant
|
|
210
|
+
content: "Pods drift through the cloud\nOrchestrator hums softly\nContainers at rest"
|
|
211
|
+
finish_reason: stop
|
|
212
|
+
usage:
|
|
213
|
+
prompt_tokens: 24
|
|
214
|
+
completion_tokens: 15
|
|
215
|
+
total_tokens: 39
|
|
216
|
+
"400":
|
|
217
|
+
description: Invalid request (malformed JSON or missing fields)
|
|
218
|
+
content:
|
|
219
|
+
application/json:
|
|
220
|
+
schema:
|
|
221
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
222
|
+
"502":
|
|
223
|
+
description: Upstream provider error
|
|
224
|
+
content:
|
|
225
|
+
application/json:
|
|
226
|
+
schema:
|
|
227
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
228
|
+
"503":
|
|
229
|
+
description: No providers available (no API keys configured)
|
|
230
|
+
content:
|
|
231
|
+
application/json:
|
|
232
|
+
schema:
|
|
233
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
234
|
+
|
|
235
|
+
# ============================================================
|
|
236
|
+
# TEXT COMPLETIONS
|
|
237
|
+
# ============================================================
|
|
238
|
+
/v1/completions:
|
|
239
|
+
post:
|
|
240
|
+
summary: Create a text completion
|
|
241
|
+
description: |
|
|
242
|
+
OpenAI-compatible text completions endpoint. Converts prompts to
|
|
243
|
+
chat messages internally and routes through A3M.
|
|
244
|
+
|
|
245
|
+
Supports streaming and non-streaming modes.
|
|
246
|
+
operationId: createCompletion
|
|
247
|
+
tags:
|
|
248
|
+
- Completions
|
|
249
|
+
requestBody:
|
|
250
|
+
required: true
|
|
251
|
+
content:
|
|
252
|
+
application/json:
|
|
253
|
+
schema:
|
|
254
|
+
type: object
|
|
255
|
+
required:
|
|
256
|
+
- prompt
|
|
257
|
+
properties:
|
|
258
|
+
model:
|
|
259
|
+
type: string
|
|
260
|
+
default: auto
|
|
261
|
+
description: Model or routing mode (same semantics as /v1/chat/completions)
|
|
262
|
+
prompt:
|
|
263
|
+
oneOf:
|
|
264
|
+
- type: string
|
|
265
|
+
- type: array
|
|
266
|
+
items:
|
|
267
|
+
type: string
|
|
268
|
+
description: Text prompt(s) to complete
|
|
269
|
+
stream:
|
|
270
|
+
type: boolean
|
|
271
|
+
default: false
|
|
272
|
+
description: Enable SSE streaming
|
|
273
|
+
temperature:
|
|
274
|
+
type: number
|
|
275
|
+
minimum: 0
|
|
276
|
+
maximum: 2
|
|
277
|
+
max_tokens:
|
|
278
|
+
type: integer
|
|
279
|
+
default: 1024
|
|
280
|
+
top_p:
|
|
281
|
+
type: number
|
|
282
|
+
echo:
|
|
283
|
+
type: boolean
|
|
284
|
+
default: false
|
|
285
|
+
description: Echo the prompt in the response
|
|
286
|
+
stop:
|
|
287
|
+
oneOf:
|
|
288
|
+
- type: string
|
|
289
|
+
- type: array
|
|
290
|
+
items:
|
|
291
|
+
type: string
|
|
292
|
+
example:
|
|
293
|
+
model: auto
|
|
294
|
+
prompt: "The capital of France is"
|
|
295
|
+
max_tokens: 50
|
|
296
|
+
responses:
|
|
297
|
+
"200":
|
|
298
|
+
description: Successful completion
|
|
299
|
+
content:
|
|
300
|
+
application/json:
|
|
301
|
+
schema:
|
|
302
|
+
type: object
|
|
303
|
+
properties:
|
|
304
|
+
id:
|
|
305
|
+
type: string
|
|
306
|
+
object:
|
|
307
|
+
type: string
|
|
308
|
+
default: text_completion
|
|
309
|
+
created:
|
|
310
|
+
type: integer
|
|
311
|
+
model:
|
|
312
|
+
type: string
|
|
313
|
+
choices:
|
|
314
|
+
type: array
|
|
315
|
+
items:
|
|
316
|
+
type: object
|
|
317
|
+
properties:
|
|
318
|
+
text:
|
|
319
|
+
type: string
|
|
320
|
+
index:
|
|
321
|
+
type: integer
|
|
322
|
+
finish_reason:
|
|
323
|
+
type: string
|
|
324
|
+
usage:
|
|
325
|
+
type: object
|
|
326
|
+
properties:
|
|
327
|
+
prompt_tokens:
|
|
328
|
+
type: integer
|
|
329
|
+
completion_tokens:
|
|
330
|
+
type: integer
|
|
331
|
+
total_tokens:
|
|
332
|
+
type: integer
|
|
333
|
+
example:
|
|
334
|
+
id: chatcmpl-abc123
|
|
335
|
+
object: text_completion
|
|
336
|
+
created: 1716000000
|
|
337
|
+
model: llama-3.3-70b-versatile
|
|
338
|
+
choices:
|
|
339
|
+
- text: " Paris."
|
|
340
|
+
index: 0
|
|
341
|
+
finish_reason: stop
|
|
342
|
+
usage:
|
|
343
|
+
prompt_tokens: 5
|
|
344
|
+
completion_tokens: 2
|
|
345
|
+
total_tokens: 7
|
|
346
|
+
"400":
|
|
347
|
+
description: Invalid request
|
|
348
|
+
content:
|
|
349
|
+
application/json:
|
|
350
|
+
schema:
|
|
351
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
352
|
+
"502":
|
|
353
|
+
description: Upstream provider error
|
|
354
|
+
content:
|
|
355
|
+
application/json:
|
|
356
|
+
schema:
|
|
357
|
+
$ref: "#/components/schemas/ErrorResponse"
|
|
358
|
+
|
|
359
|
+
# ============================================================
|
|
360
|
+
# ROUTE (QUERY ANALYSIS)
|
|
361
|
+
# ============================================================
|
|
362
|
+
/v1/route:
|
|
363
|
+
post:
|
|
364
|
+
summary: Route a query without executing it
|
|
365
|
+
description: |
|
|
366
|
+
Analyze a query and return the optimal routing decision —
|
|
367
|
+
model selection, tier, cost estimate, complexity score, and
|
|
368
|
+
fallback alternatives — without calling any LLM provider.
|
|
369
|
+
operationId: routeQuery
|
|
370
|
+
tags:
|
|
371
|
+
- Routing
|
|
372
|
+
requestBody:
|
|
373
|
+
required: true
|
|
374
|
+
content:
|
|
375
|
+
application/json:
|
|
376
|
+
schema:
|
|
377
|
+
type: object
|
|
378
|
+
required:
|
|
379
|
+
- query
|
|
380
|
+
properties:
|
|
381
|
+
query:
|
|
382
|
+
type: string
|
|
383
|
+
description: The query to route
|
|
384
|
+
example: Write a Python function to sort an array
|
|
385
|
+
max_cost:
|
|
386
|
+
type: number
|
|
387
|
+
description: Maximum acceptable cost in USD
|
|
388
|
+
example: 0.001
|
|
389
|
+
preferred_tier:
|
|
390
|
+
type: string
|
|
391
|
+
enum:
|
|
392
|
+
- free
|
|
393
|
+
- cheap
|
|
394
|
+
- mid
|
|
395
|
+
- premium
|
|
396
|
+
description: Constrain routing to a specific cost tier
|
|
397
|
+
example:
|
|
398
|
+
query: Write a Python function to sort an array
|
|
399
|
+
responses:
|
|
400
|
+
"200":
|
|
401
|
+
description: Routing decision
|
|
402
|
+
content:
|
|
403
|
+
application/json:
|
|
404
|
+
schema:
|
|
405
|
+
type: object
|
|
406
|
+
properties:
|
|
407
|
+
primary_model:
|
|
408
|
+
type: string
|
|
409
|
+
description: Selected model identifier
|
|
410
|
+
example: groq/llama-3.3-70b-versatile
|
|
411
|
+
fallback_models:
|
|
412
|
+
type: array
|
|
413
|
+
items:
|
|
414
|
+
type: string
|
|
415
|
+
description: Alternative models in priority order
|
|
416
|
+
example:
|
|
417
|
+
- cerebras/llama-3.3-70b
|
|
418
|
+
- mistral/mistral-small
|
|
419
|
+
confidence:
|
|
420
|
+
type: number
|
|
421
|
+
description: Routing confidence score (0–1)
|
|
422
|
+
example: 0.82
|
|
423
|
+
reasoning:
|
|
424
|
+
type: string
|
|
425
|
+
description: Human-readable explanation of the routing decision
|
|
426
|
+
example: Selected Groq for code detected, fast tier
|
|
427
|
+
estimated_cost:
|
|
428
|
+
type: number
|
|
429
|
+
description: Estimated cost in USD
|
|
430
|
+
example: 0.00035
|
|
431
|
+
estimated_latency_ms:
|
|
432
|
+
type: integer
|
|
433
|
+
description: Estimated time to first token in ms
|
|
434
|
+
example: 800
|
|
435
|
+
features:
|
|
436
|
+
type: object
|
|
437
|
+
description: Query feature breakdown used for routing
|
|
438
|
+
properties:
|
|
439
|
+
complexity:
|
|
440
|
+
type: number
|
|
441
|
+
description: Query complexity score (0.0–1.0)
|
|
442
|
+
example: 0.35
|
|
443
|
+
has_code:
|
|
444
|
+
type: boolean
|
|
445
|
+
description: Code-related keywords detected
|
|
446
|
+
has_math:
|
|
447
|
+
type: boolean
|
|
448
|
+
description: Mathematical expression detected
|
|
449
|
+
is_multilingual:
|
|
450
|
+
type: boolean
|
|
451
|
+
description: Non-ASCII characters detected
|
|
452
|
+
is_translation:
|
|
453
|
+
type: boolean
|
|
454
|
+
description: Translation request detected
|
|
455
|
+
is_creative:
|
|
456
|
+
type: boolean
|
|
457
|
+
description: Creative writing request
|
|
458
|
+
requires_reasoning:
|
|
459
|
+
type: boolean
|
|
460
|
+
description: Analytical/reasoning verbs detected
|
|
461
|
+
is_security:
|
|
462
|
+
type: boolean
|
|
463
|
+
description: Security domain keywords
|
|
464
|
+
is_devops:
|
|
465
|
+
type: boolean
|
|
466
|
+
description: DevOps/infrastructure keywords
|
|
467
|
+
is_data:
|
|
468
|
+
type: boolean
|
|
469
|
+
description: Data/ML keywords
|
|
470
|
+
detected_domain:
|
|
471
|
+
type: string
|
|
472
|
+
description: Best matching domain
|
|
473
|
+
enum:
|
|
474
|
+
- legal
|
|
475
|
+
- medical
|
|
476
|
+
- finance
|
|
477
|
+
- security
|
|
478
|
+
- architecture
|
|
479
|
+
- ml_research
|
|
480
|
+
- devops
|
|
481
|
+
- data
|
|
482
|
+
example: ""
|
|
483
|
+
domain_score:
|
|
484
|
+
type: number
|
|
485
|
+
description: Domain match confidence (0.0–1.0)
|
|
486
|
+
tier:
|
|
487
|
+
type: string
|
|
488
|
+
enum:
|
|
489
|
+
- free
|
|
490
|
+
- cheap
|
|
491
|
+
- mid
|
|
492
|
+
- premium
|
|
493
|
+
description: Selected cost tier
|
|
494
|
+
example:
|
|
495
|
+
primary_model: groq/llama-3.3-70b-versatile
|
|
496
|
+
fallback_models:
|
|
497
|
+
- cerebras/llama-3.3-70b
|
|
498
|
+
- mistral/mistral-small
|
|
499
|
+
confidence: 0.82
|
|
500
|
+
reasoning: Selected Groq for code detected, fast tier
|
|
501
|
+
estimated_cost: 0.00035
|
|
502
|
+
estimated_latency_ms: 800
|
|
503
|
+
features:
|
|
504
|
+
complexity: 0.35
|
|
505
|
+
has_code: true
|
|
506
|
+
has_math: false
|
|
507
|
+
requires_reasoning: false
|
|
508
|
+
detected_domain: ""
|
|
509
|
+
tier: cheap
|
|
510
|
+
|
|
511
|
+
# ============================================================
|
|
512
|
+
# LIST MODELS
|
|
513
|
+
# ============================================================
|
|
514
|
+
/v1/models:
|
|
515
|
+
get:
|
|
516
|
+
summary: List available models
|
|
517
|
+
description: |
|
|
518
|
+
Returns all available models across all configured providers,
|
|
519
|
+
organized as an OpenAI-compatible model list.
|
|
520
|
+
operationId: listModels
|
|
521
|
+
tags:
|
|
522
|
+
- Models
|
|
523
|
+
responses:
|
|
524
|
+
"200":
|
|
525
|
+
description: List of available models
|
|
526
|
+
content:
|
|
527
|
+
application/json:
|
|
528
|
+
schema:
|
|
529
|
+
type: object
|
|
530
|
+
properties:
|
|
531
|
+
object:
|
|
532
|
+
type: string
|
|
533
|
+
default: list
|
|
534
|
+
data:
|
|
535
|
+
type: array
|
|
536
|
+
items:
|
|
537
|
+
type: object
|
|
538
|
+
properties:
|
|
539
|
+
id:
|
|
540
|
+
type: string
|
|
541
|
+
description: Model identifier (provider/model format)
|
|
542
|
+
example: groq/llama-3.3-70b-versatile
|
|
543
|
+
object:
|
|
544
|
+
type: string
|
|
545
|
+
default: model
|
|
546
|
+
owned_by:
|
|
547
|
+
type: string
|
|
548
|
+
description: Provider name
|
|
549
|
+
example: groq
|
|
550
|
+
example:
|
|
551
|
+
object: list
|
|
552
|
+
data:
|
|
553
|
+
- id: groq/llama-3.3-70b-versatile
|
|
554
|
+
object: model
|
|
555
|
+
owned_by: groq
|
|
556
|
+
- id: groq/llama-3.1-8b-instant
|
|
557
|
+
object: model
|
|
558
|
+
owned_by: groq
|
|
559
|
+
- id: cerebras/llama-3.3-70b
|
|
560
|
+
object: model
|
|
561
|
+
owned_by: cerebras
|
|
562
|
+
- id: openai/gpt-4o-mini
|
|
563
|
+
object: model
|
|
564
|
+
owned_by: openai
|
|
565
|
+
|
|
566
|
+
# ============================================================
|
|
567
|
+
# HEALTH
|
|
568
|
+
# ============================================================
|
|
569
|
+
/health:
|
|
570
|
+
get:
|
|
571
|
+
summary: Health check
|
|
572
|
+
description: |
|
|
573
|
+
Returns server health status, configured provider details,
|
|
574
|
+
cost summary, and recent request log.
|
|
575
|
+
operationId: healthCheck
|
|
576
|
+
tags:
|
|
577
|
+
- Monitoring
|
|
578
|
+
responses:
|
|
579
|
+
"200":
|
|
580
|
+
description: Service health information
|
|
581
|
+
content:
|
|
582
|
+
application/json:
|
|
583
|
+
schema:
|
|
584
|
+
type: object
|
|
585
|
+
properties:
|
|
586
|
+
status:
|
|
587
|
+
type: string
|
|
588
|
+
example: ok
|
|
589
|
+
version:
|
|
590
|
+
type: string
|
|
591
|
+
description: A3M Router version
|
|
592
|
+
example: 2.14.0
|
|
593
|
+
providers:
|
|
594
|
+
type: object
|
|
595
|
+
properties:
|
|
596
|
+
total:
|
|
597
|
+
type: integer
|
|
598
|
+
description: Total configured providers
|
|
599
|
+
healthy:
|
|
600
|
+
type: integer
|
|
601
|
+
description: Providers with API keys available
|
|
602
|
+
details:
|
|
603
|
+
type: object
|
|
604
|
+
description: Per-provider status map
|
|
605
|
+
additionalProperties:
|
|
606
|
+
type: object
|
|
607
|
+
properties:
|
|
608
|
+
name:
|
|
609
|
+
type: string
|
|
610
|
+
type:
|
|
611
|
+
type: string
|
|
612
|
+
enum:
|
|
613
|
+
- api
|
|
614
|
+
- cli
|
|
615
|
+
- local
|
|
616
|
+
models:
|
|
617
|
+
type: integer
|
|
618
|
+
available:
|
|
619
|
+
type: boolean
|
|
620
|
+
cost:
|
|
621
|
+
type: object
|
|
622
|
+
properties:
|
|
623
|
+
total:
|
|
624
|
+
type: number
|
|
625
|
+
description: Total cost tracked in USD
|
|
626
|
+
requests:
|
|
627
|
+
type: integer
|
|
628
|
+
description: Total requests tracked
|
|
629
|
+
uptime:
|
|
630
|
+
type: number
|
|
631
|
+
description: Server uptime in seconds
|
|
632
|
+
recentRequests:
|
|
633
|
+
type: array
|
|
634
|
+
description: Last 20 request logs
|
|
635
|
+
items:
|
|
636
|
+
type: object
|
|
637
|
+
properties:
|
|
638
|
+
id:
|
|
639
|
+
type: string
|
|
640
|
+
model:
|
|
641
|
+
type: string
|
|
642
|
+
resolvedProvider:
|
|
643
|
+
type: string
|
|
644
|
+
resolvedModel:
|
|
645
|
+
type: string
|
|
646
|
+
latencyMs:
|
|
647
|
+
type: integer
|
|
648
|
+
tokensIn:
|
|
649
|
+
type: integer
|
|
650
|
+
tokensOut:
|
|
651
|
+
type: integer
|
|
652
|
+
cost:
|
|
653
|
+
type: number
|
|
654
|
+
status:
|
|
655
|
+
type: string
|
|
656
|
+
enum:
|
|
657
|
+
- success
|
|
658
|
+
- error
|
|
659
|
+
error:
|
|
660
|
+
type: string
|
|
661
|
+
timestamp:
|
|
662
|
+
type: integer
|
|
663
|
+
example:
|
|
664
|
+
status: ok
|
|
665
|
+
version: 2.14.0
|
|
666
|
+
providers:
|
|
667
|
+
total: 12
|
|
668
|
+
healthy: 8
|
|
669
|
+
details:
|
|
670
|
+
groq:
|
|
671
|
+
name: Groq
|
|
672
|
+
type: api
|
|
673
|
+
models: 3
|
|
674
|
+
available: true
|
|
675
|
+
openai:
|
|
676
|
+
name: OpenAI
|
|
677
|
+
type: api
|
|
678
|
+
models: 2
|
|
679
|
+
available: false
|
|
680
|
+
cost:
|
|
681
|
+
total: 0.0042
|
|
682
|
+
requests: 127
|
|
683
|
+
uptime: 86400.5
|
|
684
|
+
recentRequests: []
|
|
685
|
+
|
|
686
|
+
# ============================================================
|
|
687
|
+
# DASHBOARD (HTML)
|
|
688
|
+
# ============================================================
|
|
689
|
+
/dashboard:
|
|
690
|
+
get:
|
|
691
|
+
summary: Interactive web dashboard
|
|
692
|
+
description: |
|
|
693
|
+
Returns the A3M Router dashboard HTML page — a full monitoring
|
|
694
|
+
UI with dark hacker aesthetic. Shows live provider status,
|
|
695
|
+
request logs, cost breakdown, and latency metrics. Auto-refreshes
|
|
696
|
+
every 5 seconds. The root path (GET /) also serves this page.
|
|
697
|
+
operationId: getDashboard
|
|
698
|
+
tags:
|
|
699
|
+
- Monitoring
|
|
700
|
+
responses:
|
|
701
|
+
"200":
|
|
702
|
+
description: Dashboard HTML page
|
|
703
|
+
content:
|
|
704
|
+
text/html:
|
|
705
|
+
schema:
|
|
706
|
+
type: string
|
|
707
|
+
description: Inline HTML/CSS/JS dashboard
|
|
708
|
+
|
|
709
|
+
# ============================================================
|
|
710
|
+
# DASHBOARD API: Stats
|
|
711
|
+
# ============================================================
|
|
712
|
+
/api/stats:
|
|
713
|
+
get:
|
|
714
|
+
summary: Dashboard statistics
|
|
715
|
+
description: |
|
|
716
|
+
Returns real-time aggregated statistics for the dashboard: total
|
|
717
|
+
requests, costs, latency averages, provider status, and recent
|
|
718
|
+
request history.
|
|
719
|
+
operationId: getDashboardStats
|
|
720
|
+
tags:
|
|
721
|
+
- Monitoring
|
|
722
|
+
responses:
|
|
723
|
+
"200":
|
|
724
|
+
description: Dashboard stats snapshot
|
|
725
|
+
content:
|
|
726
|
+
application/json:
|
|
727
|
+
schema:
|
|
728
|
+
type: object
|
|
729
|
+
properties:
|
|
730
|
+
totalRequestsToday:
|
|
731
|
+
type: integer
|
|
732
|
+
description: Total requests since midnight
|
|
733
|
+
totalCostToday:
|
|
734
|
+
type: number
|
|
735
|
+
description: Total cost since midnight in USD
|
|
736
|
+
avgLatency:
|
|
737
|
+
type: number
|
|
738
|
+
description: Average latency across all providers in ms
|
|
739
|
+
activeProviders:
|
|
740
|
+
type: integer
|
|
741
|
+
description: Number of providers with online status
|
|
742
|
+
totalProviders:
|
|
743
|
+
type: integer
|
|
744
|
+
description: Total configured providers
|
|
745
|
+
providers:
|
|
746
|
+
type: array
|
|
747
|
+
items:
|
|
748
|
+
type: object
|
|
749
|
+
properties:
|
|
750
|
+
id:
|
|
751
|
+
type: string
|
|
752
|
+
name:
|
|
753
|
+
type: string
|
|
754
|
+
status:
|
|
755
|
+
type: string
|
|
756
|
+
enum:
|
|
757
|
+
- online
|
|
758
|
+
- offline
|
|
759
|
+
requestsToday:
|
|
760
|
+
type: integer
|
|
761
|
+
costToday:
|
|
762
|
+
type: number
|
|
763
|
+
avgLatency:
|
|
764
|
+
type: number
|
|
765
|
+
lastError:
|
|
766
|
+
type: string
|
|
767
|
+
nullable: true
|
|
768
|
+
lastErrorTime:
|
|
769
|
+
type: integer
|
|
770
|
+
nullable: true
|
|
771
|
+
recentRequests:
|
|
772
|
+
type: array
|
|
773
|
+
items:
|
|
774
|
+
type: object
|
|
775
|
+
properties:
|
|
776
|
+
timestamp:
|
|
777
|
+
type: integer
|
|
778
|
+
query:
|
|
779
|
+
type: string
|
|
780
|
+
provider:
|
|
781
|
+
type: string
|
|
782
|
+
model:
|
|
783
|
+
type: string
|
|
784
|
+
latency:
|
|
785
|
+
type: integer
|
|
786
|
+
cost:
|
|
787
|
+
type: number
|
|
788
|
+
status:
|
|
789
|
+
type: string
|
|
790
|
+
enum:
|
|
791
|
+
- success
|
|
792
|
+
- error
|
|
793
|
+
error:
|
|
794
|
+
type: string
|
|
795
|
+
tokens:
|
|
796
|
+
type: object
|
|
797
|
+
properties:
|
|
798
|
+
input:
|
|
799
|
+
type: integer
|
|
800
|
+
output:
|
|
801
|
+
type: integer
|
|
802
|
+
costByProvider:
|
|
803
|
+
type: object
|
|
804
|
+
description: Per-provider cost breakdown
|
|
805
|
+
additionalProperties:
|
|
806
|
+
type: number
|
|
807
|
+
uptime:
|
|
808
|
+
type: number
|
|
809
|
+
description: Server uptime in ms
|
|
810
|
+
|
|
811
|
+
# ============================================================
|
|
812
|
+
# DASHBOARD API: Providers
|
|
813
|
+
# ============================================================
|
|
814
|
+
/api/providers:
|
|
815
|
+
get:
|
|
816
|
+
summary: Provider status list
|
|
817
|
+
description: |
|
|
818
|
+
Returns per-provider statistics for the dashboard: request counts,
|
|
819
|
+
costs, latency, and error status.
|
|
820
|
+
operationId: getDashboardProviders
|
|
821
|
+
tags:
|
|
822
|
+
- Monitoring
|
|
823
|
+
responses:
|
|
824
|
+
"200":
|
|
825
|
+
description: Provider stats array
|
|
826
|
+
content:
|
|
827
|
+
application/json:
|
|
828
|
+
schema:
|
|
829
|
+
type: array
|
|
830
|
+
items:
|
|
831
|
+
type: object
|
|
832
|
+
properties:
|
|
833
|
+
id:
|
|
834
|
+
type: string
|
|
835
|
+
name:
|
|
836
|
+
type: string
|
|
837
|
+
status:
|
|
838
|
+
type: string
|
|
839
|
+
enum:
|
|
840
|
+
- online
|
|
841
|
+
- offline
|
|
842
|
+
requestsToday:
|
|
843
|
+
type: integer
|
|
844
|
+
costToday:
|
|
845
|
+
type: number
|
|
846
|
+
avgLatency:
|
|
847
|
+
type: number
|
|
848
|
+
lastError:
|
|
849
|
+
type: string
|
|
850
|
+
nullable: true
|
|
851
|
+
lastErrorTime:
|
|
852
|
+
type: integer
|
|
853
|
+
nullable: true
|
|
854
|
+
|
|
855
|
+
# ============================================================
|
|
856
|
+
# DASHBOARD API: Requests
|
|
857
|
+
# ============================================================
|
|
858
|
+
/api/requests:
|
|
859
|
+
get:
|
|
860
|
+
summary: Recent request log
|
|
861
|
+
description: |
|
|
862
|
+
Returns the recent requests log for the dashboard.
|
|
863
|
+
operationId: getDashboardRequests
|
|
864
|
+
tags:
|
|
865
|
+
- Monitoring
|
|
866
|
+
responses:
|
|
867
|
+
"200":
|
|
868
|
+
description: Recent request entries
|
|
869
|
+
content:
|
|
870
|
+
application/json:
|
|
871
|
+
schema:
|
|
872
|
+
type: array
|
|
873
|
+
items:
|
|
874
|
+
type: object
|
|
875
|
+
properties:
|
|
876
|
+
timestamp:
|
|
877
|
+
type: integer
|
|
878
|
+
query:
|
|
879
|
+
type: string
|
|
880
|
+
provider:
|
|
881
|
+
type: string
|
|
882
|
+
model:
|
|
883
|
+
type: string
|
|
884
|
+
latency:
|
|
885
|
+
type: integer
|
|
886
|
+
cost:
|
|
887
|
+
type: number
|
|
888
|
+
status:
|
|
889
|
+
type: string
|
|
890
|
+
enum:
|
|
891
|
+
- success
|
|
892
|
+
- error
|
|
893
|
+
error:
|
|
894
|
+
type: string
|
|
895
|
+
tokens:
|
|
896
|
+
type: object
|
|
897
|
+
properties:
|
|
898
|
+
input:
|
|
899
|
+
type: integer
|
|
900
|
+
output:
|
|
901
|
+
type: integer
|
|
902
|
+
|
|
903
|
+
# ============================================================
|
|
904
|
+
# DASHBOARD API: Clear
|
|
905
|
+
# ============================================================
|
|
906
|
+
/api/clear:
|
|
907
|
+
post:
|
|
908
|
+
summary: Clear dashboard logs
|
|
909
|
+
description: |
|
|
910
|
+
Clears all dashboard statistics and recent request logs.
|
|
911
|
+
Resets per-provider request counts and cost totals.
|
|
912
|
+
operationId: clearDashboard
|
|
913
|
+
tags:
|
|
914
|
+
- Monitoring
|
|
915
|
+
responses:
|
|
916
|
+
"200":
|
|
917
|
+
description: Dashboard cleared
|
|
918
|
+
content:
|
|
919
|
+
application/json:
|
|
920
|
+
schema:
|
|
921
|
+
type: object
|
|
922
|
+
properties:
|
|
923
|
+
ok:
|
|
924
|
+
type: boolean
|
|
925
|
+
default: true
|
|
926
|
+
message:
|
|
927
|
+
type: string
|
|
928
|
+
example: Dashboard cleared
|
|
929
|
+
|
|
930
|
+
components:
|
|
931
|
+
schemas:
|
|
932
|
+
ErrorResponse:
|
|
933
|
+
type: object
|
|
934
|
+
description: Standard error response (OpenAI-compatible format)
|
|
935
|
+
properties:
|
|
936
|
+
error:
|
|
937
|
+
type: object
|
|
938
|
+
properties:
|
|
939
|
+
message:
|
|
940
|
+
type: string
|
|
941
|
+
description: Human-readable error description
|
|
942
|
+
type:
|
|
943
|
+
type: string
|
|
944
|
+
description: Error type identifier
|
|
945
|
+
enum:
|
|
946
|
+
- invalid_request_error
|
|
947
|
+
- not_found
|
|
948
|
+
- upstream_error
|
|
949
|
+
- server_error
|
|
950
|
+
code:
|
|
951
|
+
type: integer
|
|
952
|
+
description: HTTP status code
|
|
953
|
+
required:
|
|
954
|
+
- message
|
|
955
|
+
- type
|
|
956
|
+
- code
|
|
957
|
+
|
|
958
|
+
RoutingResult:
|
|
959
|
+
type: object
|
|
960
|
+
description: Result of a query routing decision
|
|
961
|
+
properties:
|
|
962
|
+
model:
|
|
963
|
+
type: string
|
|
964
|
+
description: Selected model identifier (provider/model format)
|
|
965
|
+
example: groq/llama-3.3-70b-versatile
|
|
966
|
+
tier:
|
|
967
|
+
type: string
|
|
968
|
+
enum:
|
|
969
|
+
- free
|
|
970
|
+
- cheap
|
|
971
|
+
- mid
|
|
972
|
+
- premium
|
|
973
|
+
description: Selected cost tier
|
|
974
|
+
cost:
|
|
975
|
+
type: number
|
|
976
|
+
description: Estimated cost in USD
|
|
977
|
+
example: 0.00035
|
|
978
|
+
complexity:
|
|
979
|
+
type: number
|
|
980
|
+
description: Query complexity score (0.0–1.0)
|
|
981
|
+
reasoning:
|
|
982
|
+
type: string
|
|
983
|
+
description: Human-readable explanation
|
|
984
|
+
fallbackModels:
|
|
985
|
+
type: array
|
|
986
|
+
items:
|
|
987
|
+
type: string
|
|
988
|
+
description: Alternative models in priority order
|
|
989
|
+
isFree:
|
|
990
|
+
type: boolean
|
|
991
|
+
description: Whether the selected model is free
|
|
992
|
+
isExpert:
|
|
993
|
+
type: boolean
|
|
994
|
+
description: Whether this is an expert-level query
|
|
995
|
+
|
|
996
|
+
QueryFeatures:
|
|
997
|
+
type: object
|
|
998
|
+
description: Query feature breakdown used for routing classification
|
|
999
|
+
properties:
|
|
1000
|
+
complexity:
|
|
1001
|
+
type: number
|
|
1002
|
+
description: Overall complexity score (0.0–1.0)
|
|
1003
|
+
length:
|
|
1004
|
+
type: integer
|
|
1005
|
+
description: Word count
|
|
1006
|
+
has_code:
|
|
1007
|
+
type: boolean
|
|
1008
|
+
description: Code-related keywords detected
|
|
1009
|
+
has_math:
|
|
1010
|
+
type: boolean
|
|
1011
|
+
description: Math-related keywords detected
|
|
1012
|
+
is_multilingual:
|
|
1013
|
+
type: boolean
|
|
1014
|
+
description: Non-ASCII characters detected
|
|
1015
|
+
is_translation:
|
|
1016
|
+
type: boolean
|
|
1017
|
+
description: Translation request detected
|
|
1018
|
+
is_creative:
|
|
1019
|
+
type: boolean
|
|
1020
|
+
description: Creative writing request
|
|
1021
|
+
requires_reasoning:
|
|
1022
|
+
type: boolean
|
|
1023
|
+
description: Analytical/reasoning verbs detected
|
|
1024
|
+
is_security:
|
|
1025
|
+
type: boolean
|
|
1026
|
+
description: Security domain keywords
|
|
1027
|
+
is_devops:
|
|
1028
|
+
type: boolean
|
|
1029
|
+
description: DevOps/infrastructure keywords
|
|
1030
|
+
is_data:
|
|
1031
|
+
type: boolean
|
|
1032
|
+
description: Data/ML keywords
|
|
1033
|
+
detected_domain:
|
|
1034
|
+
type: string
|
|
1035
|
+
description: Best matching domain
|
|
1036
|
+
enum:
|
|
1037
|
+
- legal
|
|
1038
|
+
- medical
|
|
1039
|
+
- finance
|
|
1040
|
+
- security
|
|
1041
|
+
- architecture
|
|
1042
|
+
- ml_research
|
|
1043
|
+
- devops
|
|
1044
|
+
- data
|
|
1045
|
+
domain_score:
|
|
1046
|
+
type: number
|
|
1047
|
+
description: Domain match confidence (0.0–1.0)
|
|
1048
|
+
|
|
1049
|
+
ChatCompletionRequest:
|
|
1050
|
+
type: object
|
|
1051
|
+
required:
|
|
1052
|
+
- messages
|
|
1053
|
+
properties:
|
|
1054
|
+
model:
|
|
1055
|
+
type: string
|
|
1056
|
+
default: auto
|
|
1057
|
+
messages:
|
|
1058
|
+
type: array
|
|
1059
|
+
items:
|
|
1060
|
+
$ref: "#/components/schemas/ChatMessage"
|
|
1061
|
+
temperature:
|
|
1062
|
+
type: number
|
|
1063
|
+
max_tokens:
|
|
1064
|
+
type: integer
|
|
1065
|
+
default: 1024
|
|
1066
|
+
stream:
|
|
1067
|
+
type: boolean
|
|
1068
|
+
default: false
|
|
1069
|
+
top_p:
|
|
1070
|
+
type: number
|
|
1071
|
+
frequency_penalty:
|
|
1072
|
+
type: number
|
|
1073
|
+
presence_penalty:
|
|
1074
|
+
type: number
|
|
1075
|
+
stop:
|
|
1076
|
+
oneOf:
|
|
1077
|
+
- type: string
|
|
1078
|
+
- type: array
|
|
1079
|
+
items:
|
|
1080
|
+
type: string
|
|
1081
|
+
|
|
1082
|
+
ChatMessage:
|
|
1083
|
+
type: object
|
|
1084
|
+
required:
|
|
1085
|
+
- role
|
|
1086
|
+
- content
|
|
1087
|
+
properties:
|
|
1088
|
+
role:
|
|
1089
|
+
type: string
|
|
1090
|
+
enum:
|
|
1091
|
+
- system
|
|
1092
|
+
- user
|
|
1093
|
+
- assistant
|
|
1094
|
+
- tool
|
|
1095
|
+
content:
|
|
1096
|
+
type: string
|
|
1097
|
+
|
|
1098
|
+
ChatCompletionResponse:
|
|
1099
|
+
type: object
|
|
1100
|
+
properties:
|
|
1101
|
+
id:
|
|
1102
|
+
type: string
|
|
1103
|
+
object:
|
|
1104
|
+
type: string
|
|
1105
|
+
default: chat.completion
|
|
1106
|
+
created:
|
|
1107
|
+
type: integer
|
|
1108
|
+
model:
|
|
1109
|
+
type: string
|
|
1110
|
+
choices:
|
|
1111
|
+
type: array
|
|
1112
|
+
items:
|
|
1113
|
+
type: object
|
|
1114
|
+
properties:
|
|
1115
|
+
index:
|
|
1116
|
+
type: integer
|
|
1117
|
+
message:
|
|
1118
|
+
type: object
|
|
1119
|
+
properties:
|
|
1120
|
+
role:
|
|
1121
|
+
type: string
|
|
1122
|
+
content:
|
|
1123
|
+
type: string
|
|
1124
|
+
finish_reason:
|
|
1125
|
+
type: string
|
|
1126
|
+
usage:
|
|
1127
|
+
type: object
|
|
1128
|
+
properties:
|
|
1129
|
+
prompt_tokens:
|
|
1130
|
+
type: integer
|
|
1131
|
+
completion_tokens:
|
|
1132
|
+
type: integer
|
|
1133
|
+
total_tokens:
|
|
1134
|
+
type: integer
|
|
1135
|
+
|
|
1136
|
+
StreamingChunk:
|
|
1137
|
+
type: object
|
|
1138
|
+
description: SSE streaming chunk (chat.completion.chunk format)
|
|
1139
|
+
properties:
|
|
1140
|
+
id:
|
|
1141
|
+
type: string
|
|
1142
|
+
object:
|
|
1143
|
+
type: string
|
|
1144
|
+
default: chat.completion.chunk
|
|
1145
|
+
created:
|
|
1146
|
+
type: integer
|
|
1147
|
+
model:
|
|
1148
|
+
type: string
|
|
1149
|
+
choices:
|
|
1150
|
+
type: array
|
|
1151
|
+
items:
|
|
1152
|
+
type: object
|
|
1153
|
+
properties:
|
|
1154
|
+
index:
|
|
1155
|
+
type: integer
|
|
1156
|
+
delta:
|
|
1157
|
+
type: object
|
|
1158
|
+
properties:
|
|
1159
|
+
content:
|
|
1160
|
+
type: string
|
|
1161
|
+
role:
|
|
1162
|
+
type: string
|
|
1163
|
+
finish_reason:
|
|
1164
|
+
type: string
|
|
1165
|
+
nullable: true
|
|
1166
|
+
|
|
1167
|
+
DashboardStats:
|
|
1168
|
+
type: object
|
|
1169
|
+
properties:
|
|
1170
|
+
totalRequestsToday:
|
|
1171
|
+
type: integer
|
|
1172
|
+
totalCostToday:
|
|
1173
|
+
type: number
|
|
1174
|
+
avgLatency:
|
|
1175
|
+
type: number
|
|
1176
|
+
activeProviders:
|
|
1177
|
+
type: integer
|
|
1178
|
+
totalProviders:
|
|
1179
|
+
type: integer
|
|
1180
|
+
providers:
|
|
1181
|
+
type: array
|
|
1182
|
+
items:
|
|
1183
|
+
$ref: "#/components/schemas/ProviderStat"
|
|
1184
|
+
recentRequests:
|
|
1185
|
+
type: array
|
|
1186
|
+
items:
|
|
1187
|
+
$ref: "#/components/schemas/RequestEntry"
|
|
1188
|
+
costByProvider:
|
|
1189
|
+
type: object
|
|
1190
|
+
additionalProperties:
|
|
1191
|
+
type: number
|
|
1192
|
+
uptime:
|
|
1193
|
+
type: number
|
|
1194
|
+
|
|
1195
|
+
ProviderStat:
|
|
1196
|
+
type: object
|
|
1197
|
+
properties:
|
|
1198
|
+
id:
|
|
1199
|
+
type: string
|
|
1200
|
+
name:
|
|
1201
|
+
type: string
|
|
1202
|
+
status:
|
|
1203
|
+
type: string
|
|
1204
|
+
enum:
|
|
1205
|
+
- online
|
|
1206
|
+
- offline
|
|
1207
|
+
requestsToday:
|
|
1208
|
+
type: integer
|
|
1209
|
+
costToday:
|
|
1210
|
+
type: number
|
|
1211
|
+
avgLatency:
|
|
1212
|
+
type: number
|
|
1213
|
+
lastError:
|
|
1214
|
+
type: string
|
|
1215
|
+
nullable: true
|
|
1216
|
+
lastErrorTime:
|
|
1217
|
+
type: integer
|
|
1218
|
+
nullable: true
|
|
1219
|
+
|
|
1220
|
+
RequestEntry:
|
|
1221
|
+
type: object
|
|
1222
|
+
properties:
|
|
1223
|
+
timestamp:
|
|
1224
|
+
type: integer
|
|
1225
|
+
query:
|
|
1226
|
+
type: string
|
|
1227
|
+
provider:
|
|
1228
|
+
type: string
|
|
1229
|
+
model:
|
|
1230
|
+
type: string
|
|
1231
|
+
latency:
|
|
1232
|
+
type: integer
|
|
1233
|
+
cost:
|
|
1234
|
+
type: number
|
|
1235
|
+
status:
|
|
1236
|
+
type: string
|
|
1237
|
+
enum:
|
|
1238
|
+
- success
|
|
1239
|
+
- error
|
|
1240
|
+
error:
|
|
1241
|
+
type: string
|
|
1242
|
+
tokens:
|
|
1243
|
+
type: object
|
|
1244
|
+
properties:
|
|
1245
|
+
input:
|
|
1246
|
+
type: integer
|
|
1247
|
+
output:
|
|
1248
|
+
type: integer
|
|
1249
|
+
|
|
1250
|
+
HealthResponse:
|
|
1251
|
+
type: object
|
|
1252
|
+
properties:
|
|
1253
|
+
status:
|
|
1254
|
+
type: string
|
|
1255
|
+
version:
|
|
1256
|
+
type: string
|
|
1257
|
+
providers:
|
|
1258
|
+
type: object
|
|
1259
|
+
properties:
|
|
1260
|
+
total:
|
|
1261
|
+
type: integer
|
|
1262
|
+
healthy:
|
|
1263
|
+
type: integer
|
|
1264
|
+
details:
|
|
1265
|
+
type: object
|
|
1266
|
+
additionalProperties:
|
|
1267
|
+
type: object
|
|
1268
|
+
properties:
|
|
1269
|
+
name:
|
|
1270
|
+
type: string
|
|
1271
|
+
type:
|
|
1272
|
+
type: string
|
|
1273
|
+
models:
|
|
1274
|
+
type: integer
|
|
1275
|
+
available:
|
|
1276
|
+
type: boolean
|
|
1277
|
+
cost:
|
|
1278
|
+
type: object
|
|
1279
|
+
properties:
|
|
1280
|
+
total:
|
|
1281
|
+
type: number
|
|
1282
|
+
requests:
|
|
1283
|
+
type: integer
|
|
1284
|
+
uptime:
|
|
1285
|
+
type: number
|
|
1286
|
+
recentRequests:
|
|
1287
|
+
type: array
|
|
1288
|
+
items:
|
|
1289
|
+
$ref: "#/components/schemas/RequestLogEntry"
|
|
1290
|
+
|
|
1291
|
+
RequestLogEntry:
|
|
1292
|
+
type: object
|
|
1293
|
+
properties:
|
|
1294
|
+
id:
|
|
1295
|
+
type: string
|
|
1296
|
+
model:
|
|
1297
|
+
type: string
|
|
1298
|
+
resolvedProvider:
|
|
1299
|
+
type: string
|
|
1300
|
+
resolvedModel:
|
|
1301
|
+
type: string
|
|
1302
|
+
latencyMs:
|
|
1303
|
+
type: integer
|
|
1304
|
+
tokensIn:
|
|
1305
|
+
type: integer
|
|
1306
|
+
tokensOut:
|
|
1307
|
+
type: integer
|
|
1308
|
+
cost:
|
|
1309
|
+
type: number
|
|
1310
|
+
status:
|
|
1311
|
+
type: string
|
|
1312
|
+
enum:
|
|
1313
|
+
- success
|
|
1314
|
+
- error
|
|
1315
|
+
error:
|
|
1316
|
+
type: string
|
|
1317
|
+
timestamp:
|
|
1318
|
+
type: integer
|