-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
2924 lines (2849 loc) · 94.7 KB
/
Copy pathopenapi.yaml
File metadata and controls
2924 lines (2849 loc) · 94.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: llmproxy
version: 1.0.0
description: |
Self-hosted, OpenAI-compatible LLM proxy. A single static Go binary that
routes OpenAI-dialect requests to registered upstream providers, with
per-user API keys, a curated model catalog and per-unit usage accounting.
Surface areas:
* `/v1` - OpenAI-compatible ingress. Request bodies are passed through to
the upstream byte-for-byte at the field level, so any field OpenAI's
chat/completions/embeddings endpoints accept is accepted here. The proxy
itself only reads or rewrites four top-level fields: `model` (replaced
with the upstream model name), `stream`, `stream_options`
(`include_usage` is forced to `true` on streamed requests) and, for
embeddings, `input` (batch-size cap only). Everything else, including
nested message content, vision parts and tool calls, is forwarded as raw
bytes and never inspected. Upstream responses, including upstream error
bodies and status codes, pass through unchanged. The same routes are
also served at the root without the `/v1` prefix for clients configured
that way.
* `/model/*` - model-management compatibility endpoints (`/model/new`,
`/model/info`, `/model/delete`) for existing proxy management tooling.
* `/my` - self-service key, relay-token and usage management for the
calling principal.
* `/transparent/anthropic/{token}` - transparent Anthropic relay. Any
method and sub-path is forwarded verbatim to the Anthropic API with the
caller's own credentials; the relay token in the path only attributes
usage to a principal.
* `/admin/v1` - admin API (providers, models, principals, keys, pricing,
usage, requests, audit events). Requires the admin role: an admin API
key, or an admin browser session (mutations are origin-checked).
* `/auth` - browser login: identity (`/auth/me`), admin password
(`/auth/password`) and OIDC SSO (authorization code flow, active when
`LLMPROXY_OIDC_ISSUER` is configured).
* `/` - built-in web UI, an embedded React app that is a plain client of
the endpoints in this spec.
* `/healthz`, `/metrics` - operational endpoints, unauthenticated.
Proxy-generated errors always use the envelope in `ErrorEnvelope` with
`type` fixed to `llmproxy_error` and a stable machine `code`, and carry the
header `x-llmproxy-error-source: proxy`. Upstream errors are relayed
unmodified with `x-llmproxy-error-source: upstream`.
license:
name: Apache 2.0
identifier: Apache-2.0
servers:
- url: http://127.0.0.1:4000
description: Default local bind
tags:
- name: openai
description: OpenAI-compatible ingress
- name: self-service
description: Own keys, relay tokens and usage
- name: transparent
description: >
Transparent Anthropic relay. Requests to
/transparent/anthropic/{token}/{path} are forwarded to the Anthropic
API unchanged - method, path suffix, query, headers (hop-by-hop and
Cookie stripped) and body all pass through, including the caller's own
x-api-key or OAuth bearer credential. The relay token is minted under
/my/relay-tokens and only attributes usage; it authenticates nothing
else, and API keys are not accepted in its place. Usage (tokens, cost,
duration, status) is recorded from the response on the way past; no
request or response content is ever persisted.
- name: admin
description: Admin API (admin role, via API key or browser session)
- name: auth
description: Browser login (password and SSO)
- name: operational
description: Health, metrics and the built-in UI
- name: compatibility
description: >
Model-management compatibility endpoints for existing proxy management
tooling. The OpenAI routes are additionally served at
the root without the /v1 prefix (POST /chat/completions,
POST /completions, POST /embeddings, GET /models) for clients
configured that way. GET /models is also a page of the built-in UI;
a request whose Accept header lists text/html (a browser navigation)
receives the app instead of JSON. /v1/models always returns JSON.
security:
- bearerApiKey: []
- apiKeyHeader: []
- sessionCookie: []
components:
securitySchemes:
bearerApiKey:
type: http
scheme: bearer
description: >
API key (prefix `lp_`) in `Authorization: Bearer <key>`. Works on all
authenticated endpoints.
apiKeyHeader:
type: apiKey
in: header
name: x-api-key
description: >
Same API key in the `x-api-key` header. Only consulted when no bearer
`Authorization` header is present.
sessionCookie:
type: apiKey
in: cookie
name: llmproxy_session
description: >
Stateless signed browser session issued by the SSO callback or the
admin password login. Carries the principal's role: valid on `/v1`,
`/my`, and (admin role) `/admin/v1`. Non-GET requests with a
mismatching `Origin` header are rejected with 403
`cross_origin_rejected`.
headers:
XLLMProxyProvider:
description: Name of the provider that served (or was asked to serve) the request.
schema:
type: string
XLLMProxyModel:
description: Upstream model name the alias resolved to.
schema:
type: string
XLLMProxyErrorSource:
description: >
`proxy` when the error was generated by llmproxy itself, `upstream`
when an upstream error response is being relayed unchanged.
schema:
type: string
enum: [proxy, upstream]
parameters:
limit:
name: limit
in: query
description: Page size, 1 to 500. Values outside that range fall back to 100.
schema:
type: integer
minimum: 1
maximum: 500
default: 100
offset:
name: offset
in: query
description: Result offset, 0 or greater. Invalid values fall back to 0.
schema:
type: integer
minimum: 0
default: 0
since:
name: since
in: query
description: >
Inclusive lower bound, ISO 8601 (`2026-07-01`, `2026-07-01T12:00:00`,
RFC 3339 with or without fractional seconds). Empty disables the filter.
schema:
type: string
until:
name: until
in: query
description: Exclusive upper bound, same accepted formats as `since`.
schema:
type: string
bucket:
name: bucket
in: query
description: Time bucket width for a usage series.
schema:
type: string
enum: [hour, day, week, month]
default: day
schemas:
ErrorEnvelope:
type: object
description: >
Envelope for every proxy-generated error. Upstream errors are relayed
with their original body instead and are distinguishable by the
`x-llmproxy-error-source: upstream` header and the absence of this
envelope's `llmproxy.source: proxy` marker.
required: [error, llmproxy]
properties:
error:
type: object
required: [message, type, code, param]
properties:
message:
type: string
description: Human-readable description.
type:
type: string
const: llmproxy_error
code:
type: string
description: Stable machine code, e.g. `model_not_found`.
param:
type: [string, "null"]
description: Offending request field, when one applies (e.g. `model`, `input`).
llmproxy:
type: object
required: [source]
properties:
source:
type: string
const: proxy
ModelDeployment:
type: object
description: >
A model binding rendered in the deployment shape used by the
model-management compatibility endpoints. The `litellm_params` field
name is part of the wire format.
required: [model_name, litellm_params, model_info]
properties:
model_name:
type: string
description: Public alias.
litellm_params:
type: object
required: [model, api_base, custom_llm_provider]
properties:
model:
type: string
description: Upstream model name.
api_base:
type: string
description: Provider base URL. The credential is never included.
custom_llm_provider:
type: string
const: openai
model_info:
type: object
required: [id]
properties:
id:
type: string
description: Binding id; the handle for `/model/delete`.
ModelListEntry:
type: object
required: [id, object, created, owned_by]
properties:
id:
type: string
description: Public alias.
object:
type: string
const: model
created:
type: integer
description: Unix seconds of binding creation (0 if unparseable).
owned_by:
type: string
description: Provider name.
capabilities:
type: array
items:
$ref: '#/components/schemas/Capability'
description: >
Resolved capability set: for an alias, the target's. An extension
to the OpenAI shape.
alias_of:
type: string
nullable: true
description: >
The model this name points at, `null` when it binds a provider
directly. An extension to the OpenAI shape.
hidden:
type: boolean
description: >
Whether the model is kept off this list. Only ever true when the
list was fetched with `include_hidden=1`. An extension to the
OpenAI shape.
pricing:
$ref: '#/components/schemas/ModelPricing'
description: >
Prices in force for this model, per million units, present only
when the list was fetched with `include_pricing=1`. Units with no
price are left out: unpriced is not zero. An extension to the
OpenAI shape.
pricing_inherited:
type: boolean
description: >
True when a price in force is keyed on another name (the model
this one points at, or the upstream name) rather than this one.
Present only with `include_pricing=1`.
ModelList:
type: object
required: [object, data]
properties:
object:
type: string
const: list
data:
type: array
items:
$ref: '#/components/schemas/ModelListEntry'
ProxyRequestBody:
type: object
description: >
Passed through to the upstream. Only the fields listed here are read or
rewritten by the proxy; every other top-level field and all nested
content is forwarded as raw bytes.
required: [model]
additionalProperties: true
properties:
model:
type: string
description: >
Public alias of a model binding on an enabled provider.
Rewritten to the upstream model name before forwarding.
stream:
type: boolean
description: >
Read to select SSE relaying and, for chat, to require the
`chat_stream` capability. Ignored on embeddings.
stream_options:
type: object
additionalProperties: true
description: >
On streamed requests the proxy sets `include_usage: true` here
(creating the object if absent) so usage arrives in the final SSE
chunk. Other members are preserved.
input:
description: >
Embeddings only. When it is a JSON array its length is checked
against `LLMPROXY_MAX_EMBEDDING_BATCH` (default 2048); larger
batches are rejected with 400 `embedding_batch_too_large`.
String inputs and non-array shapes are forwarded untouched.
oneOf:
- type: string
- type: array
KeyView:
type: object
required: [id, key_suffix, label, created_at, last_used_at]
properties:
id:
type: string
key_suffix:
type: string
description: >
Last 4 characters of the plaintext, for display as `***xxxx`. The
plaintext itself is never stored or shown again.
label:
type: string
created_at:
type: string
description: UTC timestamp, `YYYY-MM-DDTHH:MM:SS.ssssssZ`.
last_used_at:
type: [string, "null"]
description: Coarse (refreshed at most once a minute).
KeyCreated:
allOf:
- $ref: '#/components/schemas/KeyView'
- type: object
required: [key]
properties:
key:
type: string
description: >
Plaintext API key (`lp_` prefix). Shown exactly once; only a
keyed HMAC-SHA256 hash is stored.
AdminKeyCreated:
allOf:
- $ref: '#/components/schemas/KeyCreated'
- type: object
required: [principal]
properties:
principal:
type: string
description: Name of the principal the key belongs to.
KeyDeleted:
type: object
required: [deleted]
properties:
deleted:
type: string
description: Id of the deleted key.
RelayTokenView:
type: object
required: [id, token_suffix, label, created_at, last_used_at]
properties:
id:
type: string
token_suffix:
type: string
description: >
Last 4 characters of the plaintext, for display as `***xxxx`. The
plaintext itself is never stored or shown again.
label:
type: string
created_at:
type: string
description: UTC timestamp, `YYYY-MM-DDTHH:MM:SS.ssssssZ`.
last_used_at:
type: [string, "null"]
description: Coarse (refreshed at most once a minute).
RelayTokenCreated:
allOf:
- $ref: '#/components/schemas/RelayTokenView'
- type: object
required: [token]
properties:
token:
type: string
description: >
Plaintext relay token (`lpt_` prefix). Shown exactly once;
only a keyed HMAC-SHA256 hash is stored. Goes in the
transparent relay URL path, never in an Authorization header.
UsageSummaryRow:
type: object
required: [model, endpoint, requests, cancelled, cost, units]
properties:
model:
type: string
description: Public alias.
endpoint:
type: string
description: One of `chat`, `completions`, `embeddings`, `transcription`.
requests:
type: integer
cancelled:
type: integer
description: How many of those requests were cancelled by the caller.
cost:
type: [number, "null"]
description: >
Sum of priced cost. `null` when nothing in the group was priced;
unpriced usage is never reported as zero.
units:
type: object
additionalProperties:
type: number
description: >
Per-unit quantity sums keyed by unit (`input_tokens`,
`output_tokens`, `cached_input_tokens`, `audio_seconds`).
principal:
type: string
description: >
Principal name. Present only in the admin summary
(`/admin/v1/usage/summary`).
UsageSeries:
type: object
required: [bucket, series]
properties:
bucket:
type: string
enum: [hour, day, week, month]
series:
type: array
items:
$ref: '#/components/schemas/UsageSeriesBucket'
UsageSeriesBucket:
type: object
required:
[start, requests, ok, cancelled, failed, unpriced_requests, cost, units]
properties:
start:
type: string
format: date-time
description: >
Inclusive UTC start of the bucket. Weeks start Monday; the bucket
ends where the next one starts.
requests:
type: integer
description: Total; `ok`, `cancelled` and `failed` partition it.
ok:
type: integer
cancelled:
type: integer
failed:
type: integer
description: >
Non-ok outcomes the caller did not cancel (`upstream_error`,
`unreachable`).
unpriced_requests:
type: integer
description: Requests in the bucket that hit a missing price.
cost:
type: [number, "null"]
description: >
Sum of priced cost. `null` when nothing in the bucket was priced,
including empty buckets; unpriced is never reported as zero.
units:
type: object
additionalProperties:
type: number
description: Per-unit quantity sums; empty for a bucket with no usage.
ProviderView:
type: object
required:
- name
- wire_format
- base_url
- has_credential
- verify_tls
- has_custom_ca
- timeout_connect
- timeout_read
- max_concurrency
- enabled
- created_at
properties:
name:
type: string
wire_format:
type: string
const: openai
base_url:
type: string
description: Full URL including `/v1`, trailing slash stripped.
has_credential:
type: boolean
description: >
Whether an upstream credential is stored. The credential itself is
encrypted at rest and never returned by any endpoint.
verify_tls:
type: boolean
has_custom_ca:
type: boolean
timeout_connect:
type: number
description: Seconds.
timeout_read:
type: number
description: Seconds.
max_concurrency:
type: [integer, "null"]
enabled:
type: boolean
created_at:
type: string
endpoints:
type: object
additionalProperties:
type: string
description: >
Per-endpoint URL overrides. Included on create (echo of the
request) and on single-provider GET; omitted from list responses.
ProviderCreateRequest:
type: object
required: [name, base_url]
properties:
name:
type: string
description: Must match `^[a-z0-9][a-z0-9._-]*$`, max 120 chars.
wire_format:
type: string
const: openai
default: openai
base_url:
type: string
description: Full http(s) URL including `/v1`.
api_key:
type: string
description: >
Upstream credential; optional for unauthenticated upstreams.
Stored AES-256-GCM encrypted, sent upstream as `Authorization:
Bearer`.
verify_tls:
type: boolean
default: true
ca_pem:
type: string
description: PEM bundle used as the trust root instead of the system pool.
timeout_connect:
type: number
default: 10
description: Seconds.
timeout_read:
type: number
default: 300
description: Seconds. Also the unary request deadline.
max_concurrency:
type: integer
description: Max connections per upstream host; omitted means unlimited.
endpoints:
type: object
additionalProperties:
type: string
description: >
Per-endpoint absolute URL overrides. Keys must be one of `chat`,
`completions`, `embeddings`, `transcription`; values full http(s)
URLs.
ProviderPatchRequest:
type: object
properties:
enabled:
type: boolean
base_url:
type: string
api_key:
type: string
description: >
New upstream credential. An empty string removes the stored
credential (same as `remove_credential: true`).
remove_credential:
type: boolean
verify_tls:
type: boolean
timeout_connect:
type: number
description: Seconds; must be positive.
timeout_read:
type: number
description: Seconds; must be positive. Also the unary request deadline.
max_concurrency:
type: integer
description: >
Max connections per upstream host. Zero or negative clears the
cap back to unlimited.
DiscoveredModels:
type: object
required: [provider, discovered_at, models]
properties:
provider:
type: string
discovered_at:
type: string
models:
type: array
items:
type: object
required: [upstream_name, bound_alias]
properties:
upstream_name:
type: string
bound_alias:
type: [string, "null"]
description: Existing alias bound to this upstream model, if any.
ModelView:
type: object
required:
[alias, provider, upstream_name, capabilities, target, origin,
created_at, pricing, pricing_inherited, hidden]
properties:
alias:
type: string
provider:
type: string
upstream_name:
type: string
capabilities:
type: array
items:
$ref: '#/components/schemas/Capability'
origin:
type: string
enum: [declared, discovered]
created_at:
type: string
target:
type: [string, "null"]
description: >
The model this one is a name for, or null when it routes to a
provider itself. `provider`, `upstream_name` and `capabilities`
above are always the resolved ones; for an alias they are the
target's.
pricing:
$ref: '#/components/schemas/ModelPricing'
pricing_inherited:
type: boolean
description: >
True when the price in force is not keyed on this name: inherited
from the model it points at, or from the upstream model name.
hidden:
type: boolean
description: >
True when the model is kept out of `GET /v1/models`. It still
serves requests under this name. The flag is the row's own: hiding
a model does not hide the aliases pointing at it.
ModelPricing:
type: object
description: >
Prices per million units, keyed by unit. On a write this is the
model's complete price set: a unit left out (or sent as `null`) has no
price afterwards, and usage for it is recorded as unpriced, never as
zero.
additionalProperties:
type: [number, "null"]
minimum: 0
example:
input_tokens: 0.4
output_tokens: 1.2
ModelCreateRequest:
type: object
description: >
A model either routes to a provider's model (`provider` +
`upstream_name`) or is a name for a model already bound (`target`).
Give one or the other, never both.
properties:
alias:
type: string
description: >
Globally unique public name, `^[A-Za-z0-9][A-Za-z0-9._:/-]*$`, max
200 chars. Omitted or empty means the model serves under
`upstream_name`; required when `target` is given.
provider:
type: string
upstream_name:
type: string
description: Model name sent to the upstream, max 200 chars.
target:
type: string
description: >
Name of the model this one points at, instead of `provider` and
`upstream_name`. It must route to a provider itself (aliases are
one hop) and the new model needs its own `alias`. Provider,
upstream model, capabilities and prices are inherited.
capabilities:
type: array
items:
$ref: '#/components/schemas/Capability'
default: [chat, chat_stream]
description: Ignored for a `target`; capabilities are inherited.
origin:
type: string
enum: [declared, discovered]
default: declared
pricing:
$ref: '#/components/schemas/ModelPricing'
hidden:
type: boolean
default: false
description: Bind the model but keep it off `GET /v1/models`.
ModelPatchRequest:
type: object
properties:
alias:
type: string
description: >
Rename the model. The row is kept, so its prices follow the new
name and callers only see the name move; 409 `alias_exists` if the
new name is already bound.
provider:
type: string
description: Move the model to another registered provider.
capabilities:
type: array
items:
$ref: '#/components/schemas/Capability'
upstream_name:
type: string
target:
type: string
description: >
Point this model at another model, inheriting its provider,
upstream model and capabilities. An empty string turns it back
into a binding of its own, which needs `provider` and
`upstream_name` in the same call. Sending `provider`,
`upstream_name` or `capabilities` for a model that stays an alias
is rejected with `invalid_target`.
pricing:
$ref: '#/components/schemas/ModelPricing'
hidden:
type: boolean
description: >
Take the model off `GET /v1/models`, or put it back. Accepted on
an alias too, and independent of its target. The model keeps
serving under its name either way.
Capability:
type: string
enum: [chat, chat_stream, completions, embeddings, transcription, vision]
ResolveResult:
type: object
required: [alias, provider, upstream_name, url, capabilities]
properties:
alias:
type: string
provider:
type: string
upstream_name:
type: string
url:
type: string
description: Exact upstream URL the endpoint would call.
capabilities:
type: array
items:
$ref: '#/components/schemas/Capability'
Principal:
type: object
required: [id, name, kind, role]
properties:
id:
type: string
name:
type: string
kind:
type: string
enum: [user, service]
role:
type: string
enum: [member, admin]
PrincipalCreateRequest:
type: object
required: [name]
properties:
name:
type: string
description: Must match `^[a-z0-9][a-z0-9._-]*$`, max 120 chars.
kind:
type: string
enum: [user, service]
default: user
role:
type: string
enum: [member, admin]
default: member
PricingFeed:
type: object
required: [version, entries]
properties:
version:
type: string
description: Feed version label; reloading the same version is allowed.
entries:
type: array
items:
type: object
required: [model, unit]
properties:
model:
type: string
description: Public alias or upstream model name (alias wins on lookup).
unit:
type: string
enum: [input_tokens, output_tokens, cached_input_tokens, audio_seconds]
price_per_unit:
type: number
price_per_million:
type: number
description: >
Convenience form, divided by 1,000,000 on load. Exactly one
of `price_per_unit` or `price_per_million` is required.
AdminEvent:
type: object
required: [ts, actor_principal_id, action, target_kind, target_ref]
properties:
ts:
type: string
actor_principal_id:
type: string
action:
type: string
description: >
One of `provider.create`, `provider.update`, `provider.delete`,
`model.create`, `model.update`, `model.delete`,
`principal.create`, `key.create`, `key.delete`, `pricing.load`.
target_kind:
type: string
enum: [provider, model, principal, api_key, pricing_feed]
target_ref:
type: string
responses:
Unauthorized:
description: >
No credentials (`missing_api_key`) or an unknown key
(`invalid_api_key`; deleted keys are indistinguishable from garbage).
headers:
x-llmproxy-error-source:
$ref: '#/components/headers/XLLMProxyErrorSource'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
ForbiddenAdmin:
description: >
`admin_required`: the caller's principal does not have the admin role.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
InternalError:
description: Proxy-side failure (`internal_error`).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
RequestTooLarge:
description: Body exceeds the limit (`request_too_large`).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
paths:
/healthz:
get:
tags: [operational]
summary: Liveness check
security: []
responses:
'200':
description: Always `{"status":"ok"}` while the process serves traffic.
content:
application/json:
schema:
type: object
required: [status]
properties:
status:
type: string
const: ok
/metrics:
get:
tags: [operational]
summary: Prometheus text metrics
description: >
Counters only, aggregate labels only (endpoint, provider, model alias,
outcome, unit; never per-principal): `llmproxy_requests_total`,
`llmproxy_request_seconds_sum`, `llmproxy_request_seconds_count`,
`llmproxy_usage_units_total`, `llmproxy_unpriced_units_total`.
security: []
responses:
'200':
description: Prometheus text exposition format 0.0.4.
content:
text/plain:
schema:
type: string
/:
get:
tags: [operational]
summary: Built-in web UI
description: >
The embedded React app (Greyhaven design system), served with its
assets from the binary. Sign-in via SSO (when configured) and/or the
admin password. Self-service key management and own-usage view for
everyone; provider and model management, usage by user and a request
metadata log for admins. The app drives the JSON endpoints in this
spec with the session cookie; unknown GET paths also serve the app
(SPA fallback).
security: []
responses:
'200':
description: HTML page.
content:
text/html:
schema:
type: string
/auth/me:
get:
tags: [auth]
summary: Current identity and available login methods
description: >
Accepts a session cookie or an API key; an anonymous call is a normal
200 with `authenticated: false`, so the UI's login screen can render
the right options.
security: []
responses:
'200':
description: Identity view.
content:
application/json:
schema:
type: object
properties:
authenticated:
type: boolean
name:
type: string
role:
type: string
enum: [member, admin]
sso_enabled:
type: boolean
password_enabled:
type: boolean