@bodhiapp/ts-client 0.1.7 → 0.1.9

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.
@@ -885,6 +885,18 @@ export interface components {
885
885
  ApiFormatsResponse: {
886
886
  data: components["schemas"]["ApiFormat"][];
887
887
  };
888
+ /** @description Validated API key wrapper - validates length when Some, allows None for public APIs */
889
+ ApiKey: string | null;
890
+ /** @description Represents an API key update action for API model updates */
891
+ ApiKeyUpdateAction: {
892
+ /** @enum {string} */
893
+ action: "keep";
894
+ } | {
895
+ /** @description Set a new API key (or add one if none exists) - can be None for public APIs */
896
+ value: components["schemas"]["ApiKey"];
897
+ /** @enum {string} */
898
+ action: "set";
899
+ };
888
900
  /**
889
901
  * @description Response containing API model configuration
890
902
  * @example {
@@ -905,7 +917,7 @@ export interface components {
905
917
  id: string;
906
918
  api_format: components["schemas"]["ApiFormat"];
907
919
  base_url: string;
908
- api_key_masked: string;
920
+ api_key_masked?: string | null;
909
921
  models: string[];
910
922
  prefix?: string | null;
911
923
  /** Format: date-time */
@@ -951,6 +963,7 @@ export interface components {
951
963
  /**
952
964
  * @description Application information and status
953
965
  * @example {
966
+ * "commit_sha": "abc1234",
954
967
  * "status": "ready",
955
968
  * "version": "0.1.0"
956
969
  * }
@@ -961,6 +974,11 @@ export interface components {
961
974
  * @example 0.1.0
962
975
  */
963
976
  version: string;
977
+ /**
978
+ * @description Git commit SHA of the build
979
+ * @example abc1234
980
+ */
981
+ commit_sha: string;
964
982
  /** @description Current application setup and operational status */
965
983
  status: components["schemas"]["AppStatus"];
966
984
  };
@@ -1355,8 +1373,8 @@ export interface components {
1355
1373
  api_format: components["schemas"]["ApiFormat"];
1356
1374
  /** @description API base URL */
1357
1375
  base_url: string;
1358
- /** @description API key for authentication */
1359
- api_key: string;
1376
+ /** @description API key for authentication (null for public APIs) */
1377
+ api_key?: components["schemas"]["ApiKey"];
1360
1378
  /** @description List of available models */
1361
1379
  models: string[];
1362
1380
  /** @description Optional prefix for model namespacing (e.g., "azure/" for "azure/gpt-4", "openai:" for "openai:gpt-4") */
@@ -1650,16 +1668,17 @@ export interface components {
1650
1668
  /**
1651
1669
  * @description Request to fetch available models from provider
1652
1670
  * @example {
1653
- * "api_key": "sk-...",
1654
- * "base_url": "https://api.openai.com/v1"
1671
+ * "base_url": "http://localhost:8080/v1",
1672
+ * "creds": {
1673
+ * "type": "api_key",
1674
+ * "value": null
1675
+ * }
1655
1676
  * }
1656
1677
  */
1657
1678
  FetchModelsRequest: {
1658
- /** @description API key for authentication (provide either api_key OR id, api_key takes preference if both provided) */
1659
- api_key?: string;
1660
- /** @description API model ID to look up stored credentials (provide either api_key OR id, api_key takes preference if both provided) */
1661
- id?: string;
1662
- /** @description API base URL (optional when using id) */
1679
+ /** @description Credentials to use for fetching models */
1680
+ creds?: components["schemas"]["TestCreds"];
1681
+ /** @description API base URL (required - always needed to know where to fetch models from) */
1663
1682
  base_url: string;
1664
1683
  };
1665
1684
  /**
@@ -1726,19 +1745,7 @@ export interface components {
1726
1745
  InputAudioFormat: "wav" | "mp3";
1727
1746
  ListModelResponse: {
1728
1747
  object: string;
1729
- data: {
1730
- /** @description The model identifier, which can be referenced in the API endpoints. */
1731
- id: string;
1732
- /** @description The object type, which is always "model". */
1733
- object: string;
1734
- /**
1735
- * Format: int32
1736
- * @description The Unix timestamp (in seconds) when the model was created.
1737
- */
1738
- created: number;
1739
- /** @description The organization that owns the model. */
1740
- owned_by: string;
1741
- }[];
1748
+ data: components["schemas"]["Model"][];
1742
1749
  };
1743
1750
  /** @description List users query parameters */
1744
1751
  ListUsersParams: {
@@ -1768,14 +1775,19 @@ export interface components {
1768
1775
  content: string;
1769
1776
  images?: string[] | null;
1770
1777
  };
1778
+ /** @description Describes an OpenAI model offering that can be used with the API. */
1771
1779
  Model: {
1772
- model: string;
1773
- /** Format: int32 */
1774
- modified_at: number;
1775
- /** Format: int64 */
1776
- size: number;
1777
- digest: string;
1778
- details: components["schemas"]["ModelDetails"];
1780
+ /** @description The model identifier, which can be referenced in the API endpoints. */
1781
+ id: string;
1782
+ /** @description The object type, which is always "model". */
1783
+ object: string;
1784
+ /**
1785
+ * Format: int32
1786
+ * @description The Unix timestamp (in seconds) when the model was created.
1787
+ */
1788
+ created: number;
1789
+ /** @description The organization that owns the model. */
1790
+ owned_by: string;
1779
1791
  };
1780
1792
  ModelAlias: {
1781
1793
  alias: string;
@@ -1792,22 +1804,8 @@ export interface components {
1792
1804
  parameter_size: string;
1793
1805
  quantization_level: string;
1794
1806
  };
1795
- /** @description Describes an OpenAI model offering that can be used with the API. */
1796
- ModelResponse: {
1797
- /** @description The model identifier, which can be referenced in the API endpoints. */
1798
- id: string;
1799
- /** @description The object type, which is always "model". */
1800
- object: string;
1801
- /**
1802
- * Format: int32
1803
- * @description The Unix timestamp (in seconds) when the model was created.
1804
- */
1805
- created: number;
1806
- /** @description The organization that owns the model. */
1807
- owned_by: string;
1808
- };
1809
1807
  ModelsResponse: {
1810
- models: components["schemas"]["Model"][];
1808
+ models: components["schemas"]["OllamaModel"][];
1811
1809
  };
1812
1810
  /**
1813
1811
  * @description Request to pull a model file from HuggingFace
@@ -1847,6 +1845,15 @@ export interface components {
1847
1845
  OllamaError: {
1848
1846
  error: string;
1849
1847
  };
1848
+ OllamaModel: {
1849
+ model: string;
1850
+ /** Format: int32 */
1851
+ modified_at: number;
1852
+ /** Format: int64 */
1853
+ size: number;
1854
+ digest: string;
1855
+ details: components["schemas"]["ModelDetails"];
1856
+ };
1850
1857
  /** @example {
1851
1858
  * "error": {
1852
1859
  * "code": "validation_error",
@@ -2147,21 +2154,34 @@ export interface components {
2147
2154
  template: string;
2148
2155
  };
2149
2156
  Stop: string | string[];
2157
+ /** @description Credentials for test/fetch operations */
2158
+ TestCreds: {
2159
+ /** @description Look up credentials from stored API model */
2160
+ value: string;
2161
+ /** @enum {string} */
2162
+ type: "id";
2163
+ } | {
2164
+ /** @description Use direct API key (null for no authentication) */
2165
+ value: components["schemas"]["ApiKey"];
2166
+ /** @enum {string} */
2167
+ type: "api_key";
2168
+ };
2150
2169
  /**
2151
2170
  * @description Request to test API connectivity with a prompt
2152
2171
  * @example {
2153
- * "api_key": "sk-...",
2154
2172
  * "base_url": "https://api.openai.com/v1",
2173
+ * "creds": {
2174
+ * "type": "api_key",
2175
+ * "value": "sk-..."
2176
+ * },
2155
2177
  * "model": "gpt-4",
2156
2178
  * "prompt": "Hello, how are you?"
2157
2179
  * }
2158
2180
  */
2159
2181
  TestPromptRequest: {
2160
- /** @description API key for authentication (provide either api_key OR id, api_key takes preference if both provided) */
2161
- api_key?: string;
2162
- /** @description API model ID to look up stored credentials (provide either api_key OR id, api_key takes preference if both provided) */
2163
- id?: string;
2164
- /** @description API base URL (optional when using id) */
2182
+ /** @description Credentials to use for testing */
2183
+ creds?: components["schemas"]["TestCreds"];
2184
+ /** @description API base URL */
2165
2185
  base_url: string;
2166
2186
  /** @description Model to use for testing */
2167
2187
  model: string;
@@ -2211,7 +2231,9 @@ export interface components {
2211
2231
  * @description Request to update an existing API model configuration
2212
2232
  * @example {
2213
2233
  * "api_format": "openai",
2214
- * "api_key": "sk-new-key",
2234
+ * "api_key": {
2235
+ * "action": "keep"
2236
+ * },
2215
2237
  * "base_url": "https://api.openai.com/v1",
2216
2238
  * "models": [
2217
2239
  * "gpt-4-turbo",
@@ -2225,8 +2247,8 @@ export interface components {
2225
2247
  api_format: components["schemas"]["ApiFormat"];
2226
2248
  /** @description API base URL (required) */
2227
2249
  base_url: string;
2228
- /** @description API key for authentication (optional, only update if provided for security) */
2229
- api_key?: string | null;
2250
+ /** @description API key update action (Keep/Set with Some or None) */
2251
+ api_key?: components["schemas"]["ApiKeyUpdateAction"];
2230
2252
  /** @description List of available models (required) */
2231
2253
  models: string[];
2232
2254
  /** @description Optional prefix for model namespacing */
@@ -3759,6 +3781,7 @@ export interface operations {
3759
3781
  };
3760
3782
  content: {
3761
3783
  /** @example {
3784
+ * "commit_sha": "abc1234",
3762
3785
  * "status": "ready",
3763
3786
  * "version": "0.1.0"
3764
3787
  * } */
@@ -5989,7 +6012,7 @@ export interface operations {
5989
6012
  * "object": "model",
5990
6013
  * "owned_by": "system"
5991
6014
  * } */
5992
- "application/json": components["schemas"]["ModelResponse"];
6015
+ "application/json": components["schemas"]["Model"];
5993
6016
  };
5994
6017
  };
5995
6018
  /** @description Invalid request parameters */
@@ -886,6 +886,18 @@ export interface components {
886
886
  ApiFormatsResponse: {
887
887
  data: components["schemas"]["ApiFormat"][];
888
888
  };
889
+ /** @description Validated API key wrapper - validates length when Some, allows None for public APIs */
890
+ ApiKey: string | null;
891
+ /** @description Represents an API key update action for API model updates */
892
+ ApiKeyUpdateAction: {
893
+ /** @enum {string} */
894
+ action: "keep";
895
+ } | {
896
+ /** @description Set a new API key (or add one if none exists) - can be None for public APIs */
897
+ value: components["schemas"]["ApiKey"];
898
+ /** @enum {string} */
899
+ action: "set";
900
+ };
889
901
  /**
890
902
  * @description Response containing API model configuration
891
903
  * @example {
@@ -906,7 +918,7 @@ export interface components {
906
918
  id: string;
907
919
  api_format: components["schemas"]["ApiFormat"];
908
920
  base_url: string;
909
- api_key_masked: string;
921
+ api_key_masked?: string | null;
910
922
  models: string[];
911
923
  prefix?: string | null;
912
924
  /** Format: date-time */
@@ -952,6 +964,7 @@ export interface components {
952
964
  /**
953
965
  * @description Application information and status
954
966
  * @example {
967
+ * "commit_sha": "abc1234",
955
968
  * "status": "ready",
956
969
  * "version": "0.1.0"
957
970
  * }
@@ -962,6 +975,11 @@ export interface components {
962
975
  * @example 0.1.0
963
976
  */
964
977
  version: string;
978
+ /**
979
+ * @description Git commit SHA of the build
980
+ * @example abc1234
981
+ */
982
+ commit_sha: string;
965
983
  /** @description Current application setup and operational status */
966
984
  status: components["schemas"]["AppStatus"];
967
985
  };
@@ -1356,8 +1374,8 @@ export interface components {
1356
1374
  api_format: components["schemas"]["ApiFormat"];
1357
1375
  /** @description API base URL */
1358
1376
  base_url: string;
1359
- /** @description API key for authentication */
1360
- api_key: string;
1377
+ /** @description API key for authentication (null for public APIs) */
1378
+ api_key?: components["schemas"]["ApiKey"];
1361
1379
  /** @description List of available models */
1362
1380
  models: string[];
1363
1381
  /** @description Optional prefix for model namespacing (e.g., "azure/" for "azure/gpt-4", "openai:" for "openai:gpt-4") */
@@ -1651,16 +1669,17 @@ export interface components {
1651
1669
  /**
1652
1670
  * @description Request to fetch available models from provider
1653
1671
  * @example {
1654
- * "api_key": "sk-...",
1655
- * "base_url": "https://api.openai.com/v1"
1672
+ * "base_url": "http://localhost:8080/v1",
1673
+ * "creds": {
1674
+ * "type": "api_key",
1675
+ * "value": null
1676
+ * }
1656
1677
  * }
1657
1678
  */
1658
1679
  FetchModelsRequest: {
1659
- /** @description API key for authentication (provide either api_key OR id, api_key takes preference if both provided) */
1660
- api_key?: string;
1661
- /** @description API model ID to look up stored credentials (provide either api_key OR id, api_key takes preference if both provided) */
1662
- id?: string;
1663
- /** @description API base URL (optional when using id) */
1680
+ /** @description Credentials to use for fetching models */
1681
+ creds?: components["schemas"]["TestCreds"];
1682
+ /** @description API base URL (required - always needed to know where to fetch models from) */
1664
1683
  base_url: string;
1665
1684
  };
1666
1685
  /**
@@ -1727,19 +1746,7 @@ export interface components {
1727
1746
  InputAudioFormat: "wav" | "mp3";
1728
1747
  ListModelResponse: {
1729
1748
  object: string;
1730
- data: {
1731
- /** @description The model identifier, which can be referenced in the API endpoints. */
1732
- id: string;
1733
- /** @description The object type, which is always "model". */
1734
- object: string;
1735
- /**
1736
- * Format: int32
1737
- * @description The Unix timestamp (in seconds) when the model was created.
1738
- */
1739
- created: number;
1740
- /** @description The organization that owns the model. */
1741
- owned_by: string;
1742
- }[];
1749
+ data: components["schemas"]["Model"][];
1743
1750
  };
1744
1751
  /** @description List users query parameters */
1745
1752
  ListUsersParams: {
@@ -1769,14 +1776,19 @@ export interface components {
1769
1776
  content: string;
1770
1777
  images?: string[] | null;
1771
1778
  };
1779
+ /** @description Describes an OpenAI model offering that can be used with the API. */
1772
1780
  Model: {
1773
- model: string;
1774
- /** Format: int32 */
1775
- modified_at: number;
1776
- /** Format: int64 */
1777
- size: number;
1778
- digest: string;
1779
- details: components["schemas"]["ModelDetails"];
1781
+ /** @description The model identifier, which can be referenced in the API endpoints. */
1782
+ id: string;
1783
+ /** @description The object type, which is always "model". */
1784
+ object: string;
1785
+ /**
1786
+ * Format: int32
1787
+ * @description The Unix timestamp (in seconds) when the model was created.
1788
+ */
1789
+ created: number;
1790
+ /** @description The organization that owns the model. */
1791
+ owned_by: string;
1780
1792
  };
1781
1793
  ModelAlias: {
1782
1794
  alias: string;
@@ -1793,22 +1805,8 @@ export interface components {
1793
1805
  parameter_size: string;
1794
1806
  quantization_level: string;
1795
1807
  };
1796
- /** @description Describes an OpenAI model offering that can be used with the API. */
1797
- ModelResponse: {
1798
- /** @description The model identifier, which can be referenced in the API endpoints. */
1799
- id: string;
1800
- /** @description The object type, which is always "model". */
1801
- object: string;
1802
- /**
1803
- * Format: int32
1804
- * @description The Unix timestamp (in seconds) when the model was created.
1805
- */
1806
- created: number;
1807
- /** @description The organization that owns the model. */
1808
- owned_by: string;
1809
- };
1810
1808
  ModelsResponse: {
1811
- models: components["schemas"]["Model"][];
1809
+ models: components["schemas"]["OllamaModel"][];
1812
1810
  };
1813
1811
  /**
1814
1812
  * @description Request to pull a model file from HuggingFace
@@ -1848,6 +1846,15 @@ export interface components {
1848
1846
  OllamaError: {
1849
1847
  error: string;
1850
1848
  };
1849
+ OllamaModel: {
1850
+ model: string;
1851
+ /** Format: int32 */
1852
+ modified_at: number;
1853
+ /** Format: int64 */
1854
+ size: number;
1855
+ digest: string;
1856
+ details: components["schemas"]["ModelDetails"];
1857
+ };
1851
1858
  /** @example {
1852
1859
  * "error": {
1853
1860
  * "code": "validation_error",
@@ -2148,21 +2155,34 @@ export interface components {
2148
2155
  template: string;
2149
2156
  };
2150
2157
  Stop: string | string[];
2158
+ /** @description Credentials for test/fetch operations */
2159
+ TestCreds: {
2160
+ /** @description Look up credentials from stored API model */
2161
+ value: string;
2162
+ /** @enum {string} */
2163
+ type: "id";
2164
+ } | {
2165
+ /** @description Use direct API key (null for no authentication) */
2166
+ value: components["schemas"]["ApiKey"];
2167
+ /** @enum {string} */
2168
+ type: "api_key";
2169
+ };
2151
2170
  /**
2152
2171
  * @description Request to test API connectivity with a prompt
2153
2172
  * @example {
2154
- * "api_key": "sk-...",
2155
2173
  * "base_url": "https://api.openai.com/v1",
2174
+ * "creds": {
2175
+ * "type": "api_key",
2176
+ * "value": "sk-..."
2177
+ * },
2156
2178
  * "model": "gpt-4",
2157
2179
  * "prompt": "Hello, how are you?"
2158
2180
  * }
2159
2181
  */
2160
2182
  TestPromptRequest: {
2161
- /** @description API key for authentication (provide either api_key OR id, api_key takes preference if both provided) */
2162
- api_key?: string;
2163
- /** @description API model ID to look up stored credentials (provide either api_key OR id, api_key takes preference if both provided) */
2164
- id?: string;
2165
- /** @description API base URL (optional when using id) */
2183
+ /** @description Credentials to use for testing */
2184
+ creds?: components["schemas"]["TestCreds"];
2185
+ /** @description API base URL */
2166
2186
  base_url: string;
2167
2187
  /** @description Model to use for testing */
2168
2188
  model: string;
@@ -2212,7 +2232,9 @@ export interface components {
2212
2232
  * @description Request to update an existing API model configuration
2213
2233
  * @example {
2214
2234
  * "api_format": "openai",
2215
- * "api_key": "sk-new-key",
2235
+ * "api_key": {
2236
+ * "action": "keep"
2237
+ * },
2216
2238
  * "base_url": "https://api.openai.com/v1",
2217
2239
  * "models": [
2218
2240
  * "gpt-4-turbo",
@@ -2226,8 +2248,8 @@ export interface components {
2226
2248
  api_format: components["schemas"]["ApiFormat"];
2227
2249
  /** @description API base URL (required) */
2228
2250
  base_url: string;
2229
- /** @description API key for authentication (optional, only update if provided for security) */
2230
- api_key?: string | null;
2251
+ /** @description API key update action (Keep/Set with Some or None) */
2252
+ api_key?: components["schemas"]["ApiKeyUpdateAction"];
2231
2253
  /** @description List of available models (required) */
2232
2254
  models: string[];
2233
2255
  /** @description Optional prefix for model namespacing */
@@ -3760,6 +3782,7 @@ export interface operations {
3760
3782
  };
3761
3783
  content: {
3762
3784
  /** @example {
3785
+ * "commit_sha": "abc1234",
3763
3786
  * "status": "ready",
3764
3787
  * "version": "0.1.0"
3765
3788
  * } */
@@ -5990,7 +6013,7 @@ export interface operations {
5990
6013
  * "object": "model",
5991
6014
  * "owned_by": "system"
5992
6015
  * } */
5993
- "application/json": components["schemas"]["ModelResponse"];
6016
+ "application/json": components["schemas"]["Model"];
5994
6017
  };
5995
6018
  };
5996
6019
  /** @description Invalid request parameters */
@@ -28,6 +28,22 @@ export type ApiFormat = 'openai' | 'placeholder';
28
28
  export type ApiFormatsResponse = {
29
29
  data: Array<ApiFormat>;
30
30
  };
31
+ /**
32
+ * Validated API key wrapper - validates length when Some, allows None for public APIs
33
+ */
34
+ export type ApiKey = string | null;
35
+ /**
36
+ * Represents an API key update action for API model updates
37
+ */
38
+ export type ApiKeyUpdateAction = {
39
+ action: 'keep';
40
+ } | {
41
+ /**
42
+ * Set a new API key (or add one if none exists) - can be None for public APIs
43
+ */
44
+ value: ApiKey;
45
+ action: 'set';
46
+ };
31
47
  /**
32
48
  * Response containing API model configuration
33
49
  */
@@ -35,7 +51,7 @@ export type ApiModelResponse = {
35
51
  id: string;
36
52
  api_format: ApiFormat;
37
53
  base_url: string;
38
- api_key_masked: string;
54
+ api_key_masked?: string | null;
39
55
  models: Array<string>;
40
56
  prefix?: string | null;
41
57
  created_at: string;
@@ -72,6 +88,10 @@ export type AppInfo = {
72
88
  * Application version number (semantic versioning)
73
89
  */
74
90
  version: string;
91
+ /**
92
+ * Git commit SHA of the build
93
+ */
94
+ commit_sha: string;
75
95
  /**
76
96
  * Current application setup and operational status
77
97
  */
@@ -517,9 +537,9 @@ export type CreateApiModelRequest = {
517
537
  */
518
538
  base_url: string;
519
539
  /**
520
- * API key for authentication
540
+ * API key for authentication (null for public APIs)
521
541
  */
522
- api_key: string;
542
+ api_key?: ApiKey;
523
543
  /**
524
544
  * List of available models
525
545
  */
@@ -835,15 +855,11 @@ export type ErrorBody = {
835
855
  */
836
856
  export type FetchModelsRequest = {
837
857
  /**
838
- * API key for authentication (provide either api_key OR id, api_key takes preference if both provided)
858
+ * Credentials to use for fetching models
839
859
  */
840
- api_key?: string;
860
+ creds?: TestCreds;
841
861
  /**
842
- * API model ID to look up stored credentials (provide either api_key OR id, api_key takes preference if both provided)
843
- */
844
- id?: string;
845
- /**
846
- * API base URL (optional when using id)
862
+ * API base URL (required - always needed to know where to fetch models from)
847
863
  */
848
864
  base_url: string;
849
865
  };
@@ -927,24 +943,7 @@ export type InputAudio = {
927
943
  export type InputAudioFormat = 'wav' | 'mp3';
928
944
  export type ListModelResponse = {
929
945
  object: string;
930
- data: Array<{
931
- /**
932
- * The model identifier, which can be referenced in the API endpoints.
933
- */
934
- id: string;
935
- /**
936
- * The object type, which is always "model".
937
- */
938
- object: string;
939
- /**
940
- * The Unix timestamp (in seconds) when the model was created.
941
- */
942
- created: number;
943
- /**
944
- * The organization that owns the model.
945
- */
946
- owned_by: string;
947
- }>;
946
+ data: Array<Model>;
948
947
  };
949
948
  /**
950
949
  * List users query parameters
@@ -965,31 +964,10 @@ export type Message = {
965
964
  content: string;
966
965
  images?: Array<string> | null;
967
966
  };
968
- export type Model = {
969
- model: string;
970
- modified_at: number;
971
- size: number;
972
- digest: string;
973
- details: ModelDetails;
974
- };
975
- export type ModelAlias = {
976
- alias: string;
977
- repo: string;
978
- filename: string;
979
- snapshot: string;
980
- };
981
- export type ModelDetails = {
982
- parent_model?: string | null;
983
- format: string;
984
- family: string;
985
- families?: Array<string> | null;
986
- parameter_size: string;
987
- quantization_level: string;
988
- };
989
967
  /**
990
968
  * Describes an OpenAI model offering that can be used with the API.
991
969
  */
992
- export type ModelResponse = {
970
+ export type Model = {
993
971
  /**
994
972
  * The model identifier, which can be referenced in the API endpoints.
995
973
  */
@@ -1007,8 +985,22 @@ export type ModelResponse = {
1007
985
  */
1008
986
  owned_by: string;
1009
987
  };
988
+ export type ModelAlias = {
989
+ alias: string;
990
+ repo: string;
991
+ filename: string;
992
+ snapshot: string;
993
+ };
994
+ export type ModelDetails = {
995
+ parent_model?: string | null;
996
+ format: string;
997
+ family: string;
998
+ families?: Array<string> | null;
999
+ parameter_size: string;
1000
+ quantization_level: string;
1001
+ };
1010
1002
  export type ModelsResponse = {
1011
- models: Array<Model>;
1003
+ models: Array<OllamaModel>;
1012
1004
  };
1013
1005
  /**
1014
1006
  * Request to pull a model file from HuggingFace
@@ -1036,6 +1028,13 @@ export type OaiRequestParams = {
1036
1028
  export type OllamaError = {
1037
1029
  error: string;
1038
1030
  };
1031
+ export type OllamaModel = {
1032
+ model: string;
1033
+ modified_at: number;
1034
+ size: number;
1035
+ digest: string;
1036
+ details: ModelDetails;
1037
+ };
1039
1038
  export type OpenAiApiError = {
1040
1039
  /**
1041
1040
  * Error details following OpenAI API error format
@@ -1285,19 +1284,31 @@ export type ShowResponse = {
1285
1284
  };
1286
1285
  export type Stop = string | Array<string>;
1287
1286
  /**
1288
- * Request to test API connectivity with a prompt
1287
+ * Credentials for test/fetch operations
1289
1288
  */
1290
- export type TestPromptRequest = {
1289
+ export type TestCreds = {
1291
1290
  /**
1292
- * API key for authentication (provide either api_key OR id, api_key takes preference if both provided)
1291
+ * Look up credentials from stored API model
1293
1292
  */
1294
- api_key?: string;
1293
+ value: string;
1294
+ type: 'id';
1295
+ } | {
1295
1296
  /**
1296
- * API model ID to look up stored credentials (provide either api_key OR id, api_key takes preference if both provided)
1297
+ * Use direct API key (null for no authentication)
1297
1298
  */
1298
- id?: string;
1299
+ value: ApiKey;
1300
+ type: 'api_key';
1301
+ };
1302
+ /**
1303
+ * Request to test API connectivity with a prompt
1304
+ */
1305
+ export type TestPromptRequest = {
1306
+ /**
1307
+ * Credentials to use for testing
1308
+ */
1309
+ creds?: TestCreds;
1299
1310
  /**
1300
- * API base URL (optional when using id)
1311
+ * API base URL
1301
1312
  */
1302
1313
  base_url: string;
1303
1314
  /**
@@ -1359,9 +1370,9 @@ export type UpdateApiModelRequest = {
1359
1370
  */
1360
1371
  base_url: string;
1361
1372
  /**
1362
- * API key for authentication (optional, only update if provided for security)
1373
+ * API key update action (Keep/Set with Some or None)
1363
1374
  */
1364
- api_key?: string | null;
1375
+ api_key?: ApiKeyUpdateAction;
1365
1376
  /**
1366
1377
  * List of available models (required)
1367
1378
  */
@@ -3358,7 +3369,7 @@ export type GetModelResponses = {
3358
3369
  /**
3359
3370
  * Model details
3360
3371
  */
3361
- 200: ModelResponse;
3372
+ 200: Model;
3362
3373
  };
3363
3374
  export type GetModelResponse = GetModelResponses[keyof GetModelResponses];
3364
3375
  export type ClientOptions = {
@@ -34,6 +34,24 @@ export type ApiFormatsResponse = {
34
34
  data: Array<ApiFormat>;
35
35
  };
36
36
 
37
+ /**
38
+ * Validated API key wrapper - validates length when Some, allows None for public APIs
39
+ */
40
+ export type ApiKey = string | null;
41
+
42
+ /**
43
+ * Represents an API key update action for API model updates
44
+ */
45
+ export type ApiKeyUpdateAction = {
46
+ action: 'keep';
47
+ } | {
48
+ /**
49
+ * Set a new API key (or add one if none exists) - can be None for public APIs
50
+ */
51
+ value: ApiKey;
52
+ action: 'set';
53
+ };
54
+
37
55
  /**
38
56
  * Response containing API model configuration
39
57
  */
@@ -41,7 +59,7 @@ export type ApiModelResponse = {
41
59
  id: string;
42
60
  api_format: ApiFormat;
43
61
  base_url: string;
44
- api_key_masked: string;
62
+ api_key_masked?: string | null;
45
63
  models: Array<string>;
46
64
  prefix?: string | null;
47
65
  created_at: string;
@@ -83,6 +101,10 @@ export type AppInfo = {
83
101
  * Application version number (semantic versioning)
84
102
  */
85
103
  version: string;
104
+ /**
105
+ * Git commit SHA of the build
106
+ */
107
+ commit_sha: string;
86
108
  /**
87
109
  * Current application setup and operational status
88
110
  */
@@ -579,9 +601,9 @@ export type CreateApiModelRequest = {
579
601
  */
580
602
  base_url: string;
581
603
  /**
582
- * API key for authentication
604
+ * API key for authentication (null for public APIs)
583
605
  */
584
- api_key: string;
606
+ api_key?: ApiKey;
585
607
  /**
586
608
  * List of available models
587
609
  */
@@ -912,15 +934,11 @@ export type ErrorBody = {
912
934
  */
913
935
  export type FetchModelsRequest = {
914
936
  /**
915
- * API key for authentication (provide either api_key OR id, api_key takes preference if both provided)
916
- */
917
- api_key?: string;
918
- /**
919
- * API model ID to look up stored credentials (provide either api_key OR id, api_key takes preference if both provided)
937
+ * Credentials to use for fetching models
920
938
  */
921
- id?: string;
939
+ creds?: TestCreds;
922
940
  /**
923
- * API base URL (optional when using id)
941
+ * API base URL (required - always needed to know where to fetch models from)
924
942
  */
925
943
  base_url: string;
926
944
  };
@@ -1015,24 +1033,7 @@ export type InputAudioFormat = 'wav' | 'mp3';
1015
1033
 
1016
1034
  export type ListModelResponse = {
1017
1035
  object: string;
1018
- data: Array<{
1019
- /**
1020
- * The model identifier, which can be referenced in the API endpoints.
1021
- */
1022
- id: string;
1023
- /**
1024
- * The object type, which is always "model".
1025
- */
1026
- object: string;
1027
- /**
1028
- * The Unix timestamp (in seconds) when the model was created.
1029
- */
1030
- created: number;
1031
- /**
1032
- * The organization that owns the model.
1033
- */
1034
- owned_by: string;
1035
- }>;
1036
+ data: Array<Model>;
1036
1037
  };
1037
1038
 
1038
1039
  /**
@@ -1057,34 +1058,10 @@ export type Message = {
1057
1058
  images?: Array<string> | null;
1058
1059
  };
1059
1060
 
1060
- export type Model = {
1061
- model: string;
1062
- modified_at: number;
1063
- size: number;
1064
- digest: string;
1065
- details: ModelDetails;
1066
- };
1067
-
1068
- export type ModelAlias = {
1069
- alias: string;
1070
- repo: string;
1071
- filename: string;
1072
- snapshot: string;
1073
- };
1074
-
1075
- export type ModelDetails = {
1076
- parent_model?: string | null;
1077
- format: string;
1078
- family: string;
1079
- families?: Array<string> | null;
1080
- parameter_size: string;
1081
- quantization_level: string;
1082
- };
1083
-
1084
1061
  /**
1085
1062
  * Describes an OpenAI model offering that can be used with the API.
1086
1063
  */
1087
- export type ModelResponse = {
1064
+ export type Model = {
1088
1065
  /**
1089
1066
  * The model identifier, which can be referenced in the API endpoints.
1090
1067
  */
@@ -1103,8 +1080,24 @@ export type ModelResponse = {
1103
1080
  owned_by: string;
1104
1081
  };
1105
1082
 
1083
+ export type ModelAlias = {
1084
+ alias: string;
1085
+ repo: string;
1086
+ filename: string;
1087
+ snapshot: string;
1088
+ };
1089
+
1090
+ export type ModelDetails = {
1091
+ parent_model?: string | null;
1092
+ format: string;
1093
+ family: string;
1094
+ families?: Array<string> | null;
1095
+ parameter_size: string;
1096
+ quantization_level: string;
1097
+ };
1098
+
1106
1099
  export type ModelsResponse = {
1107
- models: Array<Model>;
1100
+ models: Array<OllamaModel>;
1108
1101
  };
1109
1102
 
1110
1103
  /**
@@ -1136,6 +1129,14 @@ export type OllamaError = {
1136
1129
  error: string;
1137
1130
  };
1138
1131
 
1132
+ export type OllamaModel = {
1133
+ model: string;
1134
+ modified_at: number;
1135
+ size: number;
1136
+ digest: string;
1137
+ details: ModelDetails;
1138
+ };
1139
+
1139
1140
  export type OpenAiApiError = {
1140
1141
  /**
1141
1142
  * Error details following OpenAI API error format
@@ -1415,19 +1416,32 @@ export type ShowResponse = {
1415
1416
  export type Stop = string | Array<string>;
1416
1417
 
1417
1418
  /**
1418
- * Request to test API connectivity with a prompt
1419
+ * Credentials for test/fetch operations
1419
1420
  */
1420
- export type TestPromptRequest = {
1421
+ export type TestCreds = {
1421
1422
  /**
1422
- * API key for authentication (provide either api_key OR id, api_key takes preference if both provided)
1423
+ * Look up credentials from stored API model
1423
1424
  */
1424
- api_key?: string;
1425
+ value: string;
1426
+ type: 'id';
1427
+ } | {
1428
+ /**
1429
+ * Use direct API key (null for no authentication)
1430
+ */
1431
+ value: ApiKey;
1432
+ type: 'api_key';
1433
+ };
1434
+
1435
+ /**
1436
+ * Request to test API connectivity with a prompt
1437
+ */
1438
+ export type TestPromptRequest = {
1425
1439
  /**
1426
- * API model ID to look up stored credentials (provide either api_key OR id, api_key takes preference if both provided)
1440
+ * Credentials to use for testing
1427
1441
  */
1428
- id?: string;
1442
+ creds?: TestCreds;
1429
1443
  /**
1430
- * API base URL (optional when using id)
1444
+ * API base URL
1431
1445
  */
1432
1446
  base_url: string;
1433
1447
  /**
@@ -1496,9 +1510,9 @@ export type UpdateApiModelRequest = {
1496
1510
  */
1497
1511
  base_url: string;
1498
1512
  /**
1499
- * API key for authentication (optional, only update if provided for security)
1513
+ * API key update action (Keep/Set with Some or None)
1500
1514
  */
1501
- api_key?: string | null;
1515
+ api_key?: ApiKeyUpdateAction;
1502
1516
  /**
1503
1517
  * List of available models (required)
1504
1518
  */
@@ -3744,7 +3758,7 @@ export type GetModelResponses = {
3744
3758
  /**
3745
3759
  * Model details
3746
3760
  */
3747
- 200: ModelResponse;
3761
+ 200: Model;
3748
3762
  };
3749
3763
 
3750
3764
  export type GetModelResponse = GetModelResponses[keyof GetModelResponses];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodhiapp/ts-client",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "TypeScript types for Bodhi API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",