@bodhiapp/ts-client 0.1.27 → 0.1.28

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.
@@ -85,15 +85,53 @@ export type Alias = (UserAlias & {
85
85
  * Uses untagged serialization - each variant has its own "source" field
86
86
  */
87
87
  export type AliasResponse = UserAliasResponse | ModelAliasResponse | ApiAliasResponse;
88
+ /**
89
+ * Mirrors Anthropic's `ModelInfo` schema — full model metadata returned by
90
+ * `GET /anthropic/v1/models` and stored alongside model IDs in `ApiAlias.models`.
91
+ *
92
+ * **IMPORTANT**: Do NOT add `#[serde(skip_serializing_if = "Option::is_none")]` on the
93
+ * `Option` fields below. The Anthropic API spec marks `capabilities`, `max_input_tokens`,
94
+ * and `max_tokens` as **required** (nullable via `anyOf [T, null]`). They must serialize
95
+ * as `null` when absent, not be omitted from the JSON output.
96
+ */
97
+ export type AnthropicModel = {
98
+ id: string;
99
+ display_name: string;
100
+ /**
101
+ * RFC 3339 datetime string representing the model's release date.
102
+ */
103
+ created_at: string;
104
+ capabilities?: null | AnthropicModelCapabilities;
105
+ max_input_tokens?: number | null;
106
+ max_tokens?: number | null;
107
+ /**
108
+ * Always `"model"` — included for Anthropic API compatibility.
109
+ */
110
+ type: string;
111
+ };
112
+ /**
113
+ * Model capability information (Anthropic ModelCapabilities schema).
114
+ */
115
+ export type AnthropicModelCapabilities = {
116
+ batch: CapabilitySupport;
117
+ citations: CapabilitySupport;
118
+ code_execution: CapabilitySupport;
119
+ context_management: ContextManagementCapability;
120
+ effort: EffortCapability;
121
+ image_input: CapabilitySupport;
122
+ pdf_input: CapabilitySupport;
123
+ structured_outputs: CapabilitySupport;
124
+ thinking: ThinkingCapability;
125
+ };
88
126
  export type ApiAlias = {
89
127
  id: string;
90
128
  api_format: ApiFormat;
91
129
  base_url: string;
92
- models: JsonVec;
130
+ models: ApiModelVec;
93
131
  prefix?: string | null;
94
132
  forward_all_with_prefix: boolean;
95
- models_cache: JsonVec;
96
- cache_fetched_at: string;
133
+ extra_headers?: unknown;
134
+ extra_body?: unknown;
97
135
  created_at: string;
98
136
  updated_at: string;
99
137
  };
@@ -107,18 +145,20 @@ export type ApiAliasResponse = {
107
145
  base_url: string;
108
146
  has_api_key: boolean;
109
147
  /**
110
- * Models available through this alias (merged from cache for forward_all)
148
+ * Models available through this alias with full provider metadata
111
149
  */
112
- models: Array<string>;
150
+ models: Array<ApiModel>;
113
151
  prefix?: string | null;
114
152
  forward_all_with_prefix: boolean;
153
+ extra_headers?: unknown;
154
+ extra_body?: unknown;
115
155
  created_at: string;
116
156
  updated_at: string;
117
157
  };
118
158
  /**
119
159
  * API format/protocol specification
120
160
  */
121
- export type ApiFormat = 'openai' | 'openai_responses' | 'placeholder';
161
+ export type ApiFormat = 'openai' | 'openai_responses' | 'anthropic' | 'anthropic_oauth' | 'gemini';
122
162
  /**
123
163
  * Response containing available API formats
124
164
  */
@@ -141,6 +181,17 @@ export type ApiKeyUpdate = {
141
181
  value: ApiKey;
142
182
  action: 'set';
143
183
  };
184
+ /**
185
+ * Discriminated union of provider-specific model metadata.
186
+ * Stored as JSON in `api_model_aliases.models`.
187
+ */
188
+ export type ApiModel = (Model & {
189
+ provider: 'openai';
190
+ }) | (AnthropicModel & {
191
+ provider: 'anthropic';
192
+ }) | (GeminiModel & {
193
+ provider: 'gemini';
194
+ });
144
195
  /**
145
196
  * Input request for creating or updating an API model configuration.
146
197
  */
@@ -169,7 +220,20 @@ export type ApiModelRequest = {
169
220
  * Whether to forward all requests with this prefix (true) or only selected models (false)
170
221
  */
171
222
  forward_all_with_prefix?: boolean;
223
+ /**
224
+ * Optional extra HTTP headers to send upstream. Cannot include `Authorization`
225
+ * or `x-api-key` — those are owned by provider clients.
226
+ */
227
+ extra_headers?: unknown;
228
+ /**
229
+ * Optional extra fields to merge into the request body sent upstream
230
+ */
231
+ extra_body?: unknown;
172
232
  };
233
+ /**
234
+ * DB-storable `Vec<ApiModel>` — stored as JSON binary in SeaORM columns.
235
+ */
236
+ export type ApiModelVec = Array<ApiModel>;
173
237
  export type AppAccessRequestStatus = 'draft' | 'approved' | 'denied' | 'failed' | 'expired';
174
238
  /**
175
239
  * Application information and status
@@ -289,6 +353,12 @@ export type BodhiErrorBody = {
289
353
  [key: string]: string;
290
354
  } | null;
291
355
  };
356
+ /**
357
+ * Whether a single capability is supported by the model.
358
+ */
359
+ export type CapabilitySupport = {
360
+ supported: boolean;
361
+ };
292
362
  /**
293
363
  * Change user role request
294
364
  */
@@ -302,6 +372,14 @@ export type ContextLimits = {
302
372
  max_input_tokens?: number | null;
303
373
  max_output_tokens?: number | null;
304
374
  };
375
+ /**
376
+ * Context management capability details.
377
+ */
378
+ export type ContextManagementCapability = {
379
+ clear_thinking_20251015?: null | CapabilitySupport;
380
+ clear_tool_uses_20250919?: null | CapabilitySupport;
381
+ compact_20260112?: null | CapabilitySupport;
382
+ };
305
383
  export type CopyAliasRequest = {
306
384
  alias: string;
307
385
  };
@@ -427,6 +505,14 @@ export type DynamicRegisterResponse = {
427
505
  token_endpoint_auth_method?: string | null;
428
506
  registration_access_token?: string | null;
429
507
  };
508
+ /**
509
+ * Effort (reasoning_effort) capability details.
510
+ */
511
+ export type EffortCapability = {
512
+ high: CapabilitySupport;
513
+ low: CapabilitySupport;
514
+ max: CapabilitySupport;
515
+ };
430
516
  /**
431
517
  * Request to fetch available models from provider
432
518
  */
@@ -439,14 +525,44 @@ export type FetchModelsRequest = {
439
525
  * API base URL (required - always needed to know where to fetch models from)
440
526
  */
441
527
  base_url: string;
528
+ /**
529
+ * API format to use for fetching models (defaults to OpenAI Chat Completions)
530
+ */
531
+ api_format?: ApiFormat;
532
+ /**
533
+ * Optional extra HTTP headers. `Authorization` / `x-api-key` are forbidden.
534
+ */
535
+ extra_headers?: unknown;
536
+ /**
537
+ * Optional extra fields to merge into the request body
538
+ */
539
+ extra_body?: unknown;
442
540
  };
443
541
  /**
444
- * Response containing available models from provider
542
+ * Returns model IDs only (not full metadata) to minimize information exposure —
543
+ * the endpoint accepts an API key parameter. Full metadata is stored on create/update.
445
544
  */
446
545
  export type FetchModelsResponse = {
447
546
  models: Array<string>;
448
547
  };
449
548
  export type FlowType = 'redirect' | 'popup';
549
+ /**
550
+ * Gemini `Model` schema (see `openapi-gemini.json`).
551
+ */
552
+ export type GeminiModel = {
553
+ name: string;
554
+ version?: string;
555
+ displayName?: string | null;
556
+ description?: string | null;
557
+ inputTokenLimit?: number | null;
558
+ outputTokenLimit?: number | null;
559
+ supportedGenerationMethods?: Array<string>;
560
+ temperature?: number | null;
561
+ maxTemperature?: number | null;
562
+ topP?: number | null;
563
+ topK?: number | null;
564
+ thinking?: boolean | null;
565
+ };
450
566
  export type JsonVec = Array<string>;
451
567
  export type ListMcpServersResponse = {
452
568
  mcp_servers: Array<McpServerResponse>;
@@ -724,6 +840,27 @@ export type McpServerReviewInfo = {
724
840
  */
725
841
  instances: Array<Mcp>;
726
842
  };
843
+ /**
844
+ * Describes an OpenAI model offering that can be used with the API.
845
+ */
846
+ export type Model = {
847
+ /**
848
+ * The model identifier, which can be referenced in the API endpoints.
849
+ */
850
+ id: string;
851
+ /**
852
+ * The object type, which is always "model".
853
+ */
854
+ object: string;
855
+ /**
856
+ * The Unix timestamp (in seconds) when the model was created.
857
+ */
858
+ created: number;
859
+ /**
860
+ * The organization that owns the model.
861
+ */
862
+ owned_by: string;
863
+ };
727
864
  export type ModelAlias = {
728
865
  alias: string;
729
866
  repo: string;
@@ -1083,6 +1220,14 @@ export type TestPromptRequest = {
1083
1220
  * API format to use for the test request (defaults to OpenAI Chat Completions)
1084
1221
  */
1085
1222
  api_format?: ApiFormat;
1223
+ /**
1224
+ * Optional extra HTTP headers. `Authorization` / `x-api-key` are forbidden.
1225
+ */
1226
+ extra_headers?: unknown;
1227
+ /**
1228
+ * Optional extra fields to merge into the request body
1229
+ */
1230
+ extra_body?: unknown;
1086
1231
  };
1087
1232
  /**
1088
1233
  * Response from testing API connectivity
@@ -1092,6 +1237,20 @@ export type TestPromptResponse = {
1092
1237
  response?: string | null;
1093
1238
  error?: string | null;
1094
1239
  };
1240
+ /**
1241
+ * Thinking capability and supported type configurations.
1242
+ */
1243
+ export type ThinkingCapability = {
1244
+ supported: boolean;
1245
+ types: ThinkingTypes;
1246
+ };
1247
+ /**
1248
+ * Supported thinking type configurations.
1249
+ */
1250
+ export type ThinkingTypes = {
1251
+ adaptive: CapabilitySupport;
1252
+ enabled: CapabilitySupport;
1253
+ };
1095
1254
  export type TokenCreated = {
1096
1255
  /**
1097
1256
  * API token with bodhiapp_ prefix for programmatic access
@@ -92,15 +92,55 @@ export type Alias = (UserAlias & {
92
92
  */
93
93
  export type AliasResponse = UserAliasResponse | ModelAliasResponse | ApiAliasResponse;
94
94
 
95
+ /**
96
+ * Mirrors Anthropic's `ModelInfo` schema — full model metadata returned by
97
+ * `GET /anthropic/v1/models` and stored alongside model IDs in `ApiAlias.models`.
98
+ *
99
+ * **IMPORTANT**: Do NOT add `#[serde(skip_serializing_if = "Option::is_none")]` on the
100
+ * `Option` fields below. The Anthropic API spec marks `capabilities`, `max_input_tokens`,
101
+ * and `max_tokens` as **required** (nullable via `anyOf [T, null]`). They must serialize
102
+ * as `null` when absent, not be omitted from the JSON output.
103
+ */
104
+ export type AnthropicModel = {
105
+ id: string;
106
+ display_name: string;
107
+ /**
108
+ * RFC 3339 datetime string representing the model's release date.
109
+ */
110
+ created_at: string;
111
+ capabilities?: null | AnthropicModelCapabilities;
112
+ max_input_tokens?: number | null;
113
+ max_tokens?: number | null;
114
+ /**
115
+ * Always `"model"` — included for Anthropic API compatibility.
116
+ */
117
+ type: string;
118
+ };
119
+
120
+ /**
121
+ * Model capability information (Anthropic ModelCapabilities schema).
122
+ */
123
+ export type AnthropicModelCapabilities = {
124
+ batch: CapabilitySupport;
125
+ citations: CapabilitySupport;
126
+ code_execution: CapabilitySupport;
127
+ context_management: ContextManagementCapability;
128
+ effort: EffortCapability;
129
+ image_input: CapabilitySupport;
130
+ pdf_input: CapabilitySupport;
131
+ structured_outputs: CapabilitySupport;
132
+ thinking: ThinkingCapability;
133
+ };
134
+
95
135
  export type ApiAlias = {
96
136
  id: string;
97
137
  api_format: ApiFormat;
98
138
  base_url: string;
99
- models: JsonVec;
139
+ models: ApiModelVec;
100
140
  prefix?: string | null;
101
141
  forward_all_with_prefix: boolean;
102
- models_cache: JsonVec;
103
- cache_fetched_at: string;
142
+ extra_headers?: unknown;
143
+ extra_body?: unknown;
104
144
  created_at: string;
105
145
  updated_at: string;
106
146
  };
@@ -115,11 +155,13 @@ export type ApiAliasResponse = {
115
155
  base_url: string;
116
156
  has_api_key: boolean;
117
157
  /**
118
- * Models available through this alias (merged from cache for forward_all)
158
+ * Models available through this alias with full provider metadata
119
159
  */
120
- models: Array<string>;
160
+ models: Array<ApiModel>;
121
161
  prefix?: string | null;
122
162
  forward_all_with_prefix: boolean;
163
+ extra_headers?: unknown;
164
+ extra_body?: unknown;
123
165
  created_at: string;
124
166
  updated_at: string;
125
167
  };
@@ -127,7 +169,7 @@ export type ApiAliasResponse = {
127
169
  /**
128
170
  * API format/protocol specification
129
171
  */
130
- export type ApiFormat = 'openai' | 'openai_responses' | 'placeholder';
172
+ export type ApiFormat = 'openai' | 'openai_responses' | 'anthropic' | 'anthropic_oauth' | 'gemini';
131
173
 
132
174
  /**
133
175
  * Response containing available API formats
@@ -154,6 +196,18 @@ export type ApiKeyUpdate = {
154
196
  action: 'set';
155
197
  };
156
198
 
199
+ /**
200
+ * Discriminated union of provider-specific model metadata.
201
+ * Stored as JSON in `api_model_aliases.models`.
202
+ */
203
+ export type ApiModel = (Model & {
204
+ provider: 'openai';
205
+ }) | (AnthropicModel & {
206
+ provider: 'anthropic';
207
+ }) | (GeminiModel & {
208
+ provider: 'gemini';
209
+ });
210
+
157
211
  /**
158
212
  * Input request for creating or updating an API model configuration.
159
213
  */
@@ -182,8 +236,22 @@ export type ApiModelRequest = {
182
236
  * Whether to forward all requests with this prefix (true) or only selected models (false)
183
237
  */
184
238
  forward_all_with_prefix?: boolean;
239
+ /**
240
+ * Optional extra HTTP headers to send upstream. Cannot include `Authorization`
241
+ * or `x-api-key` — those are owned by provider clients.
242
+ */
243
+ extra_headers?: unknown;
244
+ /**
245
+ * Optional extra fields to merge into the request body sent upstream
246
+ */
247
+ extra_body?: unknown;
185
248
  };
186
249
 
250
+ /**
251
+ * DB-storable `Vec<ApiModel>` — stored as JSON binary in SeaORM columns.
252
+ */
253
+ export type ApiModelVec = Array<ApiModel>;
254
+
187
255
  export type AppAccessRequestStatus = 'draft' | 'approved' | 'denied' | 'failed' | 'expired';
188
256
 
189
257
  /**
@@ -316,6 +384,13 @@ export type BodhiErrorBody = {
316
384
  } | null;
317
385
  };
318
386
 
387
+ /**
388
+ * Whether a single capability is supported by the model.
389
+ */
390
+ export type CapabilitySupport = {
391
+ supported: boolean;
392
+ };
393
+
319
394
  /**
320
395
  * Change user role request
321
396
  */
@@ -331,6 +406,15 @@ export type ContextLimits = {
331
406
  max_output_tokens?: number | null;
332
407
  };
333
408
 
409
+ /**
410
+ * Context management capability details.
411
+ */
412
+ export type ContextManagementCapability = {
413
+ clear_thinking_20251015?: null | CapabilitySupport;
414
+ clear_tool_uses_20250919?: null | CapabilitySupport;
415
+ compact_20260112?: null | CapabilitySupport;
416
+ };
417
+
334
418
  export type CopyAliasRequest = {
335
419
  alias: string;
336
420
  };
@@ -470,6 +554,15 @@ export type DynamicRegisterResponse = {
470
554
  registration_access_token?: string | null;
471
555
  };
472
556
 
557
+ /**
558
+ * Effort (reasoning_effort) capability details.
559
+ */
560
+ export type EffortCapability = {
561
+ high: CapabilitySupport;
562
+ low: CapabilitySupport;
563
+ max: CapabilitySupport;
564
+ };
565
+
473
566
  /**
474
567
  * Request to fetch available models from provider
475
568
  */
@@ -482,10 +575,23 @@ export type FetchModelsRequest = {
482
575
  * API base URL (required - always needed to know where to fetch models from)
483
576
  */
484
577
  base_url: string;
578
+ /**
579
+ * API format to use for fetching models (defaults to OpenAI Chat Completions)
580
+ */
581
+ api_format?: ApiFormat;
582
+ /**
583
+ * Optional extra HTTP headers. `Authorization` / `x-api-key` are forbidden.
584
+ */
585
+ extra_headers?: unknown;
586
+ /**
587
+ * Optional extra fields to merge into the request body
588
+ */
589
+ extra_body?: unknown;
485
590
  };
486
591
 
487
592
  /**
488
- * Response containing available models from provider
593
+ * Returns model IDs only (not full metadata) to minimize information exposure —
594
+ * the endpoint accepts an API key parameter. Full metadata is stored on create/update.
489
595
  */
490
596
  export type FetchModelsResponse = {
491
597
  models: Array<string>;
@@ -493,6 +599,24 @@ export type FetchModelsResponse = {
493
599
 
494
600
  export type FlowType = 'redirect' | 'popup';
495
601
 
602
+ /**
603
+ * Gemini `Model` schema (see `openapi-gemini.json`).
604
+ */
605
+ export type GeminiModel = {
606
+ name: string;
607
+ version?: string;
608
+ displayName?: string | null;
609
+ description?: string | null;
610
+ inputTokenLimit?: number | null;
611
+ outputTokenLimit?: number | null;
612
+ supportedGenerationMethods?: Array<string>;
613
+ temperature?: number | null;
614
+ maxTemperature?: number | null;
615
+ topP?: number | null;
616
+ topK?: number | null;
617
+ thinking?: boolean | null;
618
+ };
619
+
496
620
  export type JsonVec = Array<string>;
497
621
 
498
622
  export type ListMcpServersResponse = {
@@ -793,6 +917,28 @@ export type McpServerReviewInfo = {
793
917
  instances: Array<Mcp>;
794
918
  };
795
919
 
920
+ /**
921
+ * Describes an OpenAI model offering that can be used with the API.
922
+ */
923
+ export type Model = {
924
+ /**
925
+ * The model identifier, which can be referenced in the API endpoints.
926
+ */
927
+ id: string;
928
+ /**
929
+ * The object type, which is always "model".
930
+ */
931
+ object: string;
932
+ /**
933
+ * The Unix timestamp (in seconds) when the model was created.
934
+ */
935
+ created: number;
936
+ /**
937
+ * The organization that owns the model.
938
+ */
939
+ owned_by: string;
940
+ };
941
+
796
942
  export type ModelAlias = {
797
943
  alias: string;
798
944
  repo: string;
@@ -1193,6 +1339,14 @@ export type TestPromptRequest = {
1193
1339
  * API format to use for the test request (defaults to OpenAI Chat Completions)
1194
1340
  */
1195
1341
  api_format?: ApiFormat;
1342
+ /**
1343
+ * Optional extra HTTP headers. `Authorization` / `x-api-key` are forbidden.
1344
+ */
1345
+ extra_headers?: unknown;
1346
+ /**
1347
+ * Optional extra fields to merge into the request body
1348
+ */
1349
+ extra_body?: unknown;
1196
1350
  };
1197
1351
 
1198
1352
  /**
@@ -1204,6 +1358,22 @@ export type TestPromptResponse = {
1204
1358
  error?: string | null;
1205
1359
  };
1206
1360
 
1361
+ /**
1362
+ * Thinking capability and supported type configurations.
1363
+ */
1364
+ export type ThinkingCapability = {
1365
+ supported: boolean;
1366
+ types: ThinkingTypes;
1367
+ };
1368
+
1369
+ /**
1370
+ * Supported thinking type configurations.
1371
+ */
1372
+ export type ThinkingTypes = {
1373
+ adaptive: CapabilitySupport;
1374
+ enabled: CapabilitySupport;
1375
+ };
1376
+
1207
1377
  export type TokenCreated = {
1208
1378
  /**
1209
1379
  * API token with bodhiapp_ prefix for programmatic access
@@ -0,0 +1 @@
1
+ export * from './types.gen';
@@ -0,0 +1,2 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export * from './types.gen';