litellm-api 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/dist/components-e9x5e8kj.js +149 -0
- package/dist/components-g21ikhwl.cjs +156 -0
- package/dist/components.cjs +8 -152
- package/dist/components.d.mts +16 -192
- package/dist/components.d.mts.map +1 -1
- package/dist/components.mjs +1 -149
- package/dist/index.cjs +40 -384
- package/dist/index.d.ts +108 -232
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4 -329
- package/dist/schemas-bqv9j0en.js +178 -0
- package/dist/schemas-j2b24ts2.cjs +228 -0
- package/dist/schemas.cjs +32 -227
- package/dist/schemas.d.mts +9 -7
- package/dist/schemas.d.mts.map +1 -1
- package/dist/schemas.mjs +1 -182
- package/dist/types.d.mts +84 -210
- package/dist/types.d.mts.map +1 -1
- package/package.json +8 -9
package/dist/components.d.mts
CHANGED
|
@@ -1,180 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @type object
|
|
7
|
-
*/
|
|
8
|
-
type CheckoutResponse = {
|
|
9
|
-
/**
|
|
10
|
-
* @description Stripe Checkout URL — redirect the user here
|
|
11
|
-
* @type string
|
|
12
|
-
*/
|
|
13
|
-
url: string;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* @type object
|
|
17
|
-
*/
|
|
18
|
-
type FreeTierResponse = {
|
|
19
|
-
/**
|
|
20
|
-
* @type string
|
|
21
|
-
*/
|
|
22
|
-
ip_hash: string;
|
|
23
|
-
/**
|
|
24
|
-
* @type integer
|
|
25
|
-
*/
|
|
26
|
-
requests_today: number;
|
|
27
|
-
/**
|
|
28
|
-
* @type integer
|
|
29
|
-
*/
|
|
30
|
-
daily_limit: number;
|
|
31
|
-
/**
|
|
32
|
-
* @type integer
|
|
33
|
-
*/
|
|
34
|
-
remaining: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* @type object
|
|
38
|
-
*/
|
|
39
|
-
type ValidationError = {
|
|
40
|
-
/**
|
|
41
|
-
* @type array
|
|
42
|
-
*/
|
|
43
|
-
loc: (string | number)[];
|
|
44
|
-
/**
|
|
45
|
-
* @type string
|
|
46
|
-
*/
|
|
47
|
-
msg: string;
|
|
48
|
-
/**
|
|
49
|
-
* @type string
|
|
50
|
-
*/
|
|
51
|
-
type: string;
|
|
52
|
-
/**
|
|
53
|
-
* @type unknown | undefined
|
|
54
|
-
*/
|
|
55
|
-
input?: unknown | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* @type object | undefined
|
|
58
|
-
*/
|
|
59
|
-
ctx?: object | undefined;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* @type object
|
|
63
|
-
*/
|
|
64
|
-
type HTTPValidationError = {
|
|
65
|
-
/**
|
|
66
|
-
* @type array | undefined
|
|
67
|
-
*/
|
|
68
|
-
detail?: ValidationError[] | undefined;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* @description A single model in the catalog.
|
|
72
|
-
* @type object
|
|
73
|
-
*/
|
|
74
|
-
type ModelCatalogEntry = {
|
|
75
|
-
/**
|
|
76
|
-
* @description Canonical model identifier (e.g. \'gpt-4o\')
|
|
77
|
-
* @type string
|
|
78
|
-
*/
|
|
79
|
-
id: string;
|
|
80
|
-
/**
|
|
81
|
-
* @default "model_catalog.entry"
|
|
82
|
-
* @type string | undefined
|
|
83
|
-
*/
|
|
84
|
-
object?: string | undefined;
|
|
85
|
-
/**
|
|
86
|
-
* @description LiteLLM provider key (e.g. \'openai\', \'azure\')
|
|
87
|
-
*/
|
|
88
|
-
provider?: (string | null) | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* @description Model mode: chat, embedding, completion, image_generation, etc.
|
|
91
|
-
*/
|
|
92
|
-
mode?: (string | null) | undefined;
|
|
93
|
-
max_input_tokens?: (number | null) | undefined;
|
|
94
|
-
max_output_tokens?: (number | null) | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* @description Legacy combined token limit
|
|
97
|
-
*/
|
|
98
|
-
max_tokens?: (number | null) | undefined;
|
|
99
|
-
input_cost_per_token?: (number | null) | undefined;
|
|
100
|
-
output_cost_per_token?: (number | null) | undefined;
|
|
101
|
-
cache_read_input_token_cost?: (number | null) | undefined;
|
|
102
|
-
input_cost_per_audio_token?: (number | null) | undefined;
|
|
103
|
-
output_cost_per_reasoning_token?: (number | null) | undefined;
|
|
104
|
-
/**
|
|
105
|
-
* @description ISO date when the model is deprecated (YYYY-MM-DD)
|
|
106
|
-
*/
|
|
107
|
-
deprecation_date?: (string | null) | undefined;
|
|
108
|
-
supports_function_calling?: (boolean | null) | undefined;
|
|
109
|
-
supports_parallel_function_calling?: (boolean | null) | undefined;
|
|
110
|
-
supports_vision?: (boolean | null) | undefined;
|
|
111
|
-
supports_audio_input?: (boolean | null) | undefined;
|
|
112
|
-
supports_audio_output?: (boolean | null) | undefined;
|
|
113
|
-
supports_prompt_caching?: (boolean | null) | undefined;
|
|
114
|
-
supports_reasoning?: (boolean | null) | undefined;
|
|
115
|
-
supports_response_schema?: (boolean | null) | undefined;
|
|
116
|
-
supports_system_messages?: (boolean | null) | undefined;
|
|
117
|
-
supports_web_search?: (boolean | null) | undefined;
|
|
118
|
-
[key: string]: unknown;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* @description Stripe-style list response.
|
|
122
|
-
* @type object
|
|
123
|
-
*/
|
|
124
|
-
type ModelCatalogListResponse = {
|
|
125
|
-
/**
|
|
126
|
-
* @default "list"
|
|
127
|
-
* @type string | undefined
|
|
128
|
-
*/
|
|
129
|
-
object?: string | undefined;
|
|
130
|
-
/**
|
|
131
|
-
* @type array
|
|
132
|
-
*/
|
|
133
|
-
data: ModelCatalogEntry[];
|
|
134
|
-
/**
|
|
135
|
-
* @description Total models matching the filters
|
|
136
|
-
* @type integer
|
|
137
|
-
*/
|
|
138
|
-
total_count: number;
|
|
139
|
-
/**
|
|
140
|
-
* @type boolean
|
|
141
|
-
*/
|
|
142
|
-
has_more: boolean;
|
|
143
|
-
/**
|
|
144
|
-
* @type integer
|
|
145
|
-
*/
|
|
146
|
-
page: number;
|
|
147
|
-
/**
|
|
148
|
-
* @type integer
|
|
149
|
-
*/
|
|
150
|
-
page_size: number;
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* @description Stripe-style list response.
|
|
154
|
-
* @type object
|
|
155
|
-
*/
|
|
156
|
-
type ListModelCatalogModelCatalogGetStatus200 = ModelCatalogListResponse;
|
|
157
|
-
/**
|
|
158
|
-
* @type object
|
|
159
|
-
*/
|
|
160
|
-
type ListModelCatalogModelCatalogGetStatus422 = HTTPValidationError;
|
|
161
|
-
/**
|
|
162
|
-
* @description Union of all possible responses
|
|
163
|
-
*/
|
|
164
|
-
type ListModelCatalogModelCatalogGetResponse = (ListModelCatalogModelCatalogGetStatus200 | ListModelCatalogModelCatalogGetStatus422);
|
|
165
|
-
/**
|
|
166
|
-
* @description A single model in the catalog.
|
|
167
|
-
* @type object
|
|
168
|
-
*/
|
|
169
|
-
type GetModelCatalogEntryModelCatalogModelIdGetStatus200 = ModelCatalogEntry;
|
|
170
|
-
/**
|
|
171
|
-
* @type object
|
|
172
|
-
*/
|
|
173
|
-
type GetModelCatalogEntryModelCatalogModelIdGetStatus422 = HTTPValidationError;
|
|
174
|
-
/**
|
|
175
|
-
* @description Union of all possible responses
|
|
176
|
-
*/
|
|
177
|
-
type GetModelCatalogEntryModelCatalogModelIdGetResponse = (GetModelCatalogEntryModelCatalogModelIdGetStatus200 | GetModelCatalogEntryModelCatalogModelIdGetStatus422);
|
|
1
|
+
import { FreeTierResponse, CheckoutResponse, GetModelCatalogEntryModelCatalogModelIdGetResponse, ListModelCatalogModelCatalogGetResponse } from './types.mjs';
|
|
178
2
|
|
|
179
3
|
type RequestInit = {
|
|
180
4
|
body?: string | FormData | URLSearchParams | undefined;
|
|
@@ -236,20 +60,20 @@ declare function checkUsageBillingUsageGet({ config }?: {
|
|
|
236
60
|
* @description Returns model pricing, context window sizes, and capability metadata from LiteLLM's built-in catalog. Supports filtering by provider, mode, model name pattern, and pagination.
|
|
237
61
|
* @link /model_catalog
|
|
238
62
|
*/
|
|
239
|
-
declare function listModelCatalogModelCatalogGet({ queryParams, config }?: {
|
|
63
|
+
declare function listModelCatalogModelCatalogGet({ queryParams, config, }?: {
|
|
240
64
|
queryParams?: {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
65
|
+
provider?: unknown;
|
|
66
|
+
mode?: unknown;
|
|
67
|
+
model?: unknown;
|
|
68
|
+
supports_vision?: unknown;
|
|
69
|
+
supports_function_calling?: unknown;
|
|
70
|
+
supports_reasoning?: unknown;
|
|
71
|
+
supports_audio_input?: unknown;
|
|
72
|
+
supports_audio_output?: unknown;
|
|
73
|
+
supports_prompt_caching?: unknown;
|
|
74
|
+
supports_response_schema?: unknown;
|
|
75
|
+
page?: number;
|
|
76
|
+
page_size?: number;
|
|
253
77
|
};
|
|
254
78
|
config?: Partial<FetcherConfig> & {
|
|
255
79
|
client?: typeof client;
|
|
@@ -260,9 +84,9 @@ declare function listModelCatalogModelCatalogGet({ queryParams, config }?: {
|
|
|
260
84
|
* @description Returns detailed information for a specific model by its exact ID.
|
|
261
85
|
* @link /model_catalog/{model_id}
|
|
262
86
|
*/
|
|
263
|
-
declare function getModelCatalogEntryModelCatalogModelIdGet({ pathParams, config }?: {
|
|
87
|
+
declare function getModelCatalogEntryModelCatalogModelIdGet({ pathParams, config, }?: {
|
|
264
88
|
pathParams: {
|
|
265
|
-
|
|
89
|
+
model_id: string;
|
|
266
90
|
};
|
|
267
91
|
config?: Partial<FetcherConfig> & {
|
|
268
92
|
client?: typeof client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.mts","sources":["../src/
|
|
1
|
+
{"version":3,"file":"components.d.mts","sources":["../src/utils/fetch.ts","../src/utils/fetcher.ts","../src/generated/components.ts"],"mappings":";;AAAA,KAAK,WAAW;AAChB,oBAAoB,QAAQ,GAAG,eAAe;AAC9C,cAAc,MAAM;AACpB;AACA;AACA;AACA,KAAK,QAAQ;AACb;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,KAAK,SAAS,wBAAwB,WAAW,iBAAiB,OAAO,CAAC,QAAQ;;ACflF,KAAK,aAAa;AAClB;AACA;AACA,gBAAgB,SAAS;AACzB,cAAc,MAAM;AACpB;AAKA,KAAK,cAAc;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,WAAW;AACxB,IAAI,aAAa;AACjB,iBAAiB,MAAM,yJAAyJ,cAAc,+CAA+C,OAAO;;ACZpP;AACA;AACA;AACA;AACA;AACA,iBAAiB,iCAAiC;AAClD,aAAa,OAAO,CAAC,aAAa;AAClC,wBAAwBA,MAAa;AACrC;AACA,IAAI,OAAO,CAACC,gBAAwB;AACpC;AACA;AACA;AACA;AACA;AACA,iBAAiB,yBAAyB;AAC1C,aAAa,OAAO,CAAC,aAAa;AAClC,wBAAwBD,MAAa;AACrC;AACA,IAAI,OAAO,CAACE,gBAAwB;AACpC;AACA;AACA;AACA;AACA;AACA,iBAAiB,+BAA+B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO,CAAC,aAAa;AAClC,wBAAwBF,MAAa;AACrC;AACA,IAAI,OAAO,CAAC,uCAAuC;AACnD;AACA;AACA;AACA;AACA;AACA,iBAAiB,0CAA0C;AAC3D;AACA;AACA;AACA,aAAa,OAAO,CAAC,aAAa;AAClC,wBAAwBA,MAAa;AACrC;AACA,IAAI,OAAO,CAAC,kDAAkD;AAC9D,cAAc,gBAAgB;AAC9B,qCAAqC,iCAAiC;AACtE,iCAAiC,yBAAyB;AAC1D,iCAAiC,+BAA+B;AAChE,4CAA4C,0CAA0C;AACtF;AACA,cAAc,eAAe;AAC7B;AACA,kDAAkD,iCAAiC;AACnF,0CAA0C,yBAAyB;AACnE;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;;","names":["defaultClient","__types.CheckoutResponse","__types.FreeTierResponse"]}
|
package/dist/components.mjs
CHANGED
|
@@ -1,149 +1 @@
|
|
|
1
|
-
|
|
2
|
-
return value !== null && value !== undefined;
|
|
3
|
-
}
|
|
4
|
-
function compactObject(obj) {
|
|
5
|
-
return Object.fromEntries(Object.entries(obj).filter(([, value])=>notEmpty(value)));
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
async function client({ url, method, body, headers, pathParams, queryParams, signal, baseUrl = "", token = null, fetchImpl = fetch }) {
|
|
9
|
-
try {
|
|
10
|
-
const requestHeaders = compactObject({
|
|
11
|
-
"Content-Type": "application/json",
|
|
12
|
-
Authorization: token ? `Bearer ${token}` : undefined,
|
|
13
|
-
...headers
|
|
14
|
-
});
|
|
15
|
-
if (requestHeaders["Content-Type"]?.toLowerCase().includes("multipart/form-data")) {
|
|
16
|
-
delete requestHeaders["Content-Type"];
|
|
17
|
-
}
|
|
18
|
-
const payload = body instanceof FormData ? body : requestHeaders["Content-Type"] === "application/json" ? JSON.stringify(body) : body;
|
|
19
|
-
const fullUrl = `${baseUrl}${resolveUrl(url, queryParams, pathParams)}`;
|
|
20
|
-
const response = await fetchImpl(fullUrl, {
|
|
21
|
-
signal,
|
|
22
|
-
method: method.toUpperCase(),
|
|
23
|
-
body: payload,
|
|
24
|
-
headers: requestHeaders
|
|
25
|
-
});
|
|
26
|
-
if (!response.ok) {
|
|
27
|
-
let error;
|
|
28
|
-
try {
|
|
29
|
-
error = await response.json();
|
|
30
|
-
} catch (e) {
|
|
31
|
-
error = {
|
|
32
|
-
status: "unknown",
|
|
33
|
-
payload: e instanceof Error ? `Unexpected error (${e.message})` : "Unexpected error"
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
if (response.headers?.get("content-type")?.includes("json")) {
|
|
39
|
-
return await response.json();
|
|
40
|
-
} else {
|
|
41
|
-
return await response.text();
|
|
42
|
-
}
|
|
43
|
-
} catch (e) {
|
|
44
|
-
const errorObject = {
|
|
45
|
-
name: "unknown",
|
|
46
|
-
message: e instanceof Error ? `Network error (${e.message})` : "Network error",
|
|
47
|
-
stack: e
|
|
48
|
-
};
|
|
49
|
-
throw errorObject;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const resolveUrl = (url, queryParams = {}, pathParams = {})=>{
|
|
53
|
-
let query = new URLSearchParams(queryParams).toString();
|
|
54
|
-
if (query) query = `?${query}`;
|
|
55
|
-
return url.replace(/\{\w*\}/g, (key)=>pathParams[key.slice(1, -1)] ?? "") + query;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @summary Create a Stripe Checkout session for API access
|
|
60
|
-
* @description Returns a Stripe Checkout URL. After payment, you'll receive an API key.
|
|
61
|
-
* @link /billing/checkout
|
|
62
|
-
*/ async function createCheckoutBillingCheckoutPost({ config } = {}) {
|
|
63
|
-
const { client: request = client, ...requestConfig } = config ?? {};
|
|
64
|
-
const data = await request({
|
|
65
|
-
method: "POST",
|
|
66
|
-
url: `/billing/checkout`,
|
|
67
|
-
...requestConfig,
|
|
68
|
-
headers: {
|
|
69
|
-
...requestConfig.headers
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return data;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @summary Check your free-tier usage
|
|
76
|
-
* @description See how many requests you've used today (free tier, by IP).
|
|
77
|
-
* @link /billing/usage
|
|
78
|
-
*/ async function checkUsageBillingUsageGet({ config } = {}) {
|
|
79
|
-
const { client: request = client, ...requestConfig } = config ?? {};
|
|
80
|
-
const data = await request({
|
|
81
|
-
method: "GET",
|
|
82
|
-
url: `/billing/usage`,
|
|
83
|
-
...requestConfig,
|
|
84
|
-
headers: {
|
|
85
|
-
...requestConfig.headers
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
return data;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* @summary List the full LiteLLM model catalog
|
|
92
|
-
* @description Returns model pricing, context window sizes, and capability metadata from LiteLLM's built-in catalog. Supports filtering by provider, mode, model name pattern, and pagination.
|
|
93
|
-
* @link /model_catalog
|
|
94
|
-
*/ async function listModelCatalogModelCatalogGet({ queryParams, config } = {}) {
|
|
95
|
-
const { client: request = client, ...requestConfig } = config ?? {};
|
|
96
|
-
const data = await request({
|
|
97
|
-
method: "GET",
|
|
98
|
-
url: `/model_catalog`,
|
|
99
|
-
queryParams,
|
|
100
|
-
...requestConfig,
|
|
101
|
-
headers: {
|
|
102
|
-
...requestConfig.headers
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
return data;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* @summary Get a single model from the catalog
|
|
109
|
-
* @description Returns detailed information for a specific model by its exact ID.
|
|
110
|
-
* @link /model_catalog/{model_id}
|
|
111
|
-
*/ async function getModelCatalogEntryModelCatalogModelIdGet({ pathParams, config } = {}) {
|
|
112
|
-
const { client: request = client, ...requestConfig } = config ?? {};
|
|
113
|
-
if (!pathParams.model_id) {
|
|
114
|
-
throw new Error(`Missing required path parameter: model_id`);
|
|
115
|
-
}
|
|
116
|
-
const data = await request({
|
|
117
|
-
method: "GET",
|
|
118
|
-
url: `/model_catalog/${pathParams.model_id}`,
|
|
119
|
-
...requestConfig,
|
|
120
|
-
headers: {
|
|
121
|
-
...requestConfig.headers
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
return data;
|
|
125
|
-
}
|
|
126
|
-
const operationsByPath = {
|
|
127
|
-
"POST /billing/checkout": createCheckoutBillingCheckoutPost,
|
|
128
|
-
"GET /billing/usage": checkUsageBillingUsageGet,
|
|
129
|
-
"GET /model_catalog": listModelCatalogModelCatalogGet,
|
|
130
|
-
"GET /model_catalog/{model_id}": getModelCatalogEntryModelCatalogModelIdGet
|
|
131
|
-
};
|
|
132
|
-
const operationsByTag = {
|
|
133
|
-
"billing": {
|
|
134
|
-
createCheckoutBillingCheckoutPost,
|
|
135
|
-
checkUsageBillingUsageGet
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
const tagDictionary = {
|
|
139
|
-
"billing": {
|
|
140
|
-
"POST": [
|
|
141
|
-
"createCheckoutBillingCheckoutPost"
|
|
142
|
-
],
|
|
143
|
-
"GET": [
|
|
144
|
-
"checkUsageBillingUsageGet"
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export { checkUsageBillingUsageGet, createCheckoutBillingCheckoutPost, getModelCatalogEntryModelCatalogModelIdGet, listModelCatalogModelCatalogGet, operationsByPath, operationsByTag, tagDictionary };
|
|
1
|
+
export { b as checkUsageBillingUsageGet, d as createCheckoutBillingCheckoutPost, g as getModelCatalogEntryModelCatalogModelIdGet, l as listModelCatalogModelCatalogGet, a as operationsByPath, o as operationsByTag, t as tagDictionary } from './components-e9x5e8kj.js';
|