@bodhiapp/ts-client 0.1.30 → 0.1.32

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.
@@ -162,6 +162,7 @@ export type ApiAliasResponse = {
162
162
  forward_all_with_prefix: boolean;
163
163
  extra_headers?: unknown;
164
164
  extra_body?: unknown;
165
+ llm_liberty?: null | LlmLibertySummary;
165
166
  created_at: string;
166
167
  updated_at: string;
167
168
  };
@@ -169,7 +170,7 @@ export type ApiAliasResponse = {
169
170
  /**
170
171
  * API format/protocol specification
171
172
  */
172
- export type ApiFormat = 'openai' | 'openai_responses' | 'anthropic' | 'anthropic_oauth' | 'gemini';
173
+ export type ApiFormat = 'openai' | 'openai_responses' | 'anthropic' | 'anthropic_oauth' | 'gemini' | 'llm_liberty_oauth';
173
174
 
174
175
  /**
175
176
  * Response containing available API formats
@@ -210,42 +211,22 @@ export type ApiModel = (Model & {
210
211
 
211
212
  /**
212
213
  * Input request for creating or updating an API model configuration.
214
+ * Discriminated by `api_format` — `llm_liberty_oauth` uses `LlmLibertyApiModelRequest`,
215
+ * every other format uses `DefaultApiModelRequest`.
213
216
  */
214
- export type ApiModelRequest = {
215
- /**
216
- * API format/protocol (e.g., "openai")
217
- */
218
- api_format: ApiFormat;
219
- /**
220
- * API base URL
221
- */
222
- base_url: string;
223
- /**
224
- * API key update action (Keep/Set with Some or None)
225
- */
226
- api_key?: ApiKeyUpdate;
227
- /**
228
- * List of available models
229
- */
230
- models: Array<string>;
231
- /**
232
- * Optional prefix for model namespacing (e.g., "azure/" for "azure/gpt-4")
233
- */
234
- prefix?: string | null;
235
- /**
236
- * Whether to forward all requests with this prefix (true) or only selected models (false)
237
- */
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;
248
- };
217
+ export type ApiModelRequest = (DefaultApiModelRequest & {
218
+ api_format: 'openai';
219
+ }) | (DefaultApiModelRequest & {
220
+ api_format: 'openai_responses';
221
+ }) | (DefaultApiModelRequest & {
222
+ api_format: 'anthropic';
223
+ }) | (DefaultApiModelRequest & {
224
+ api_format: 'anthropic_oauth';
225
+ }) | (DefaultApiModelRequest & {
226
+ api_format: 'gemini';
227
+ }) | (LlmLibertyApiModelRequest & {
228
+ api_format: 'llm_liberty_oauth';
229
+ });
249
230
 
250
231
  /**
251
232
  * DB-storable `Vec<ApiModel>` — stored as JSON binary in SeaORM columns.
@@ -372,9 +353,15 @@ export type BodhiError = {
372
353
  /**
373
354
  * Additional error parameters as key-value pairs (for validation errors)
374
355
  */
375
- param?: {
356
+ params?: {
376
357
  [key: string]: string;
377
358
  } | null;
359
+ /**
360
+ * JSON-encoded form of `params`. Superset field so clients that speak the
361
+ * OpenAI `Error` shape (where `param` is a String) can still read it.
362
+ * Populated automatically from `params` by `BodhiError::new`.
363
+ */
364
+ param?: string | null;
378
365
  };
379
366
 
380
367
  export type BodhiErrorResponse = {
@@ -523,6 +510,94 @@ export type DashboardUser = {
523
510
  last_name?: string | null;
524
511
  };
525
512
 
513
+ /**
514
+ * Inner request shape for the five non-llm-liberty `api_format` values.
515
+ * Shared across `openai`, `openai_responses`, `anthropic`, `anthropic_oauth`, `gemini`.
516
+ */
517
+ export type DefaultApiModelRequest = {
518
+ /**
519
+ * API base URL
520
+ */
521
+ base_url: string;
522
+ /**
523
+ * API key update action (Keep/Set with Some or None)
524
+ */
525
+ api_key?: ApiKeyUpdate;
526
+ /**
527
+ * List of available models
528
+ */
529
+ models: Array<string>;
530
+ /**
531
+ * Optional prefix for model namespacing (e.g., "azure/" for "azure/gpt-4")
532
+ */
533
+ prefix?: string | null;
534
+ /**
535
+ * Whether to forward all requests with this prefix (true) or only selected models (false)
536
+ */
537
+ forward_all_with_prefix?: boolean;
538
+ /**
539
+ * Optional extra HTTP headers to send upstream. Cannot include `Authorization`
540
+ * or `x-api-key` — those are owned by provider clients.
541
+ */
542
+ extra_headers?: unknown;
543
+ /**
544
+ * Optional extra fields to merge into the request body sent upstream
545
+ */
546
+ extra_body?: unknown;
547
+ };
548
+
549
+ /**
550
+ * Inner request for the five non-llm-liberty `api_format` values.
551
+ */
552
+ export type DefaultFetchModelsRequest = {
553
+ /**
554
+ * Credentials to use for fetching models
555
+ */
556
+ creds?: TestCreds;
557
+ /**
558
+ * API base URL (required - always needed to know where to fetch models from)
559
+ */
560
+ base_url: string;
561
+ /**
562
+ * Optional extra HTTP headers. `Authorization` / `x-api-key` are forbidden.
563
+ */
564
+ extra_headers?: unknown;
565
+ /**
566
+ * Optional extra fields to merge into the request body
567
+ */
568
+ extra_body?: unknown;
569
+ };
570
+
571
+ /**
572
+ * Inner request for the five non-llm-liberty `api_format` values.
573
+ */
574
+ export type DefaultTestPromptRequest = {
575
+ /**
576
+ * Credentials to use for testing
577
+ */
578
+ creds?: TestCreds;
579
+ /**
580
+ * API base URL
581
+ */
582
+ base_url: string;
583
+ /**
584
+ * Model to use for testing
585
+ */
586
+ model: string;
587
+ /**
588
+ * Test prompt (max 30 characters for cost control)
589
+ */
590
+ prompt: string;
591
+ /**
592
+ * Optional extra HTTP headers. `Authorization` / `x-api-key` are forbidden.
593
+ */
594
+ extra_headers?: unknown;
595
+ /**
596
+ * Optional extra fields to merge into the request body
597
+ */
598
+ extra_body?: unknown;
599
+ };
600
+
526
601
  export type DeploymentMode = 'standalone' | 'multi_tenant';
527
602
 
528
603
  export type DownloadRequest = {
@@ -564,30 +639,21 @@ export type EffortCapability = {
564
639
  };
565
640
 
566
641
  /**
567
- * Request to fetch available models from provider
642
+ * Request to fetch available models from provider. Discriminated on `api_format`.
568
643
  */
569
- export type FetchModelsRequest = {
570
- /**
571
- * Credentials to use for fetching models
572
- */
573
- creds?: TestCreds;
574
- /**
575
- * API base URL (required - always needed to know where to fetch models from)
576
- */
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;
590
- };
644
+ export type FetchModelsRequest = (DefaultFetchModelsRequest & {
645
+ api_format: 'openai';
646
+ }) | (DefaultFetchModelsRequest & {
647
+ api_format: 'openai_responses';
648
+ }) | (DefaultFetchModelsRequest & {
649
+ api_format: 'anthropic';
650
+ }) | (DefaultFetchModelsRequest & {
651
+ api_format: 'anthropic_oauth';
652
+ }) | (DefaultFetchModelsRequest & {
653
+ api_format: 'gemini';
654
+ }) | (LlmLibertyFetchModelsRequest & {
655
+ api_format: 'llm_liberty_oauth';
656
+ });
591
657
 
592
658
  /**
593
659
  * Returns model IDs only (not full metadata) to minimize information exposure —
@@ -636,6 +702,136 @@ export type ListUsersParams = {
636
702
  page_size?: number | null;
637
703
  };
638
704
 
705
+ export type LlmLibertyApiEndpoints = {
706
+ base_url: string;
707
+ chat_url: string;
708
+ models_url?: string | null;
709
+ };
710
+
711
+ /**
712
+ * Request shape for `api_format == "llm_liberty_oauth"`. Carries the full envelope
713
+ * (or `Keep` to leave existing credentials untouched on update).
714
+ */
715
+ export type LlmLibertyApiModelRequest = {
716
+ /**
717
+ * Envelope update action — Keep (update only) or Set (create/replace credentials).
718
+ */
719
+ envelope?: LlmLibertyEnvelopeUpdate;
720
+ /**
721
+ * List of available models
722
+ */
723
+ models?: Array<string>;
724
+ /**
725
+ * Optional prefix for model namespacing
726
+ */
727
+ prefix?: string | null;
728
+ /**
729
+ * Whether to forward all requests with this prefix
730
+ */
731
+ forward_all_with_prefix?: boolean;
732
+ };
733
+
734
+ export type LlmLibertyAuthSpec = {
735
+ in: string;
736
+ key: string;
737
+ scheme: string;
738
+ };
739
+
740
+ /**
741
+ * The JSON blob emitted by `npx @bodhiapp/llm-liberty@latest login`.
742
+ *
743
+ * Version field allows BodhiApp to detect breaking changes in the envelope
744
+ * schema (major-version bump = breaking). Currently only `"1.0.0"` is accepted.
745
+ */
746
+ export type LlmLibertyEnvelope = {
747
+ /**
748
+ * Envelope schema version — must be "1.0.0".
749
+ */
750
+ version: string;
751
+ /**
752
+ * Provider identifier, e.g. "anthropic" or "openai-codex".
753
+ */
754
+ provider: string;
755
+ access_token: string;
756
+ refresh_token: string;
757
+ /**
758
+ * Unix epoch seconds when the access token expires.
759
+ */
760
+ expires_at: number;
761
+ auth: LlmLibertyAuthSpec;
762
+ oauth: LlmLibertyOauthEndpoints;
763
+ api: LlmLibertyApiEndpoints;
764
+ headers?: unknown;
765
+ body?: unknown;
766
+ extra?: unknown;
767
+ };
768
+
769
+ /**
770
+ * Tagged envelope update action — either keep the existing credentials or replace them.
771
+ */
772
+ export type LlmLibertyEnvelopeUpdate = {
773
+ action: 'keep';
774
+ } | {
775
+ /**
776
+ * Replace with a new envelope (atomic re-paste).
777
+ */
778
+ value: LlmLibertyEnvelope;
779
+ action: 'set';
780
+ };
781
+
782
+ /**
783
+ * Inner request for `api_format == "llm_liberty_oauth"`. Either `id` (use stored creds)
784
+ * or `envelope` (use the provided envelope directly) must be set, never both.
785
+ */
786
+ export type LlmLibertyFetchModelsRequest = {
787
+ /**
788
+ * Edit mode: alias id whose stored credentials should be used.
789
+ */
790
+ id?: string | null;
791
+ envelope?: null | LlmLibertyEnvelope;
792
+ };
793
+
794
+ export type LlmLibertyOauthEndpoints = {
795
+ authorize_url: string;
796
+ token_url: string;
797
+ revoke_url?: string | null;
798
+ client_id: string;
799
+ client_secret?: string | null;
800
+ };
801
+
802
+ /**
803
+ * Non-secret summary of stored LLM Liberty OAuth credentials for API responses.
804
+ */
805
+ export type LlmLibertySummary = {
806
+ provider: string;
807
+ envelope_version: string;
808
+ /**
809
+ * Unix epoch seconds — when the stored access token expires.
810
+ */
811
+ expires_at: number;
812
+ has_refresh_token: boolean;
813
+ };
814
+
815
+ /**
816
+ * Inner request for `api_format == "llm_liberty_oauth"`. Either `id` (use stored creds)
817
+ * or `envelope` (use the provided envelope directly) must be set, never both.
818
+ */
819
+ export type LlmLibertyTestPromptRequest = {
820
+ /**
821
+ * Edit mode: alias id whose stored credentials should be used.
822
+ */
823
+ id?: string | null;
824
+ envelope?: null | LlmLibertyEnvelope;
825
+ /**
826
+ * Model to use for testing
827
+ */
828
+ model: string;
829
+ /**
830
+ * Test prompt (max 30 characters for cost control)
831
+ */
832
+ prompt: string;
833
+ };
834
+
639
835
  /**
640
836
  * Local model file response
641
837
  */
@@ -1316,38 +1512,21 @@ export type TestCreds = {
1316
1512
  };
1317
1513
 
1318
1514
  /**
1319
- * Request to test API connectivity with a prompt
1515
+ * Request to test API connectivity with a prompt. Discriminated on `api_format`.
1320
1516
  */
1321
- export type TestPromptRequest = {
1322
- /**
1323
- * Credentials to use for testing
1324
- */
1325
- creds?: TestCreds;
1326
- /**
1327
- * API base URL
1328
- */
1329
- base_url: string;
1330
- /**
1331
- * Model to use for testing
1332
- */
1333
- model: string;
1334
- /**
1335
- * Test prompt (max 30 characters for cost control)
1336
- */
1337
- prompt: string;
1338
- /**
1339
- * API format to use for the test request (defaults to OpenAI Chat Completions)
1340
- */
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;
1350
- };
1517
+ export type TestPromptRequest = (DefaultTestPromptRequest & {
1518
+ api_format: 'openai';
1519
+ }) | (DefaultTestPromptRequest & {
1520
+ api_format: 'openai_responses';
1521
+ }) | (DefaultTestPromptRequest & {
1522
+ api_format: 'anthropic';
1523
+ }) | (DefaultTestPromptRequest & {
1524
+ api_format: 'anthropic_oauth';
1525
+ }) | (DefaultTestPromptRequest & {
1526
+ api_format: 'gemini';
1527
+ }) | (LlmLibertyTestPromptRequest & {
1528
+ api_format: 'llm_liberty_oauth';
1529
+ });
1351
1530
 
1352
1531
  /**
1353
1532
  * Response from testing API connectivity
@@ -2101,7 +2101,7 @@ export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use
2101
2101
  /**
2102
2102
  * The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
2103
2103
  */
2104
- export type Model = string | 'claude-mythos-preview' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-1-20250805' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-3-haiku-20240307';
2104
+ export type Model = string | 'claude-mythos-preview' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-1-20250805' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514';
2105
2105
  export type MessagesPostData = {
2106
2106
  body: CreateMessageParams;
2107
2107
  headers?: {
@@ -2260,7 +2260,7 @@ export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use
2260
2260
  /**
2261
2261
  * The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
2262
2262
  */
2263
- export type Model = string | 'claude-mythos-preview' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-1-20250805' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-3-haiku-20240307';
2263
+ export type Model = string | 'claude-mythos-preview' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-1-20250805' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514';
2264
2264
 
2265
2265
  export type MessagesPostData = {
2266
2266
  body: CreateMessageParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodhiapp/ts-client",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "TypeScript types for Bodhi API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",