litellm-api 0.0.2 → 1.0.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/dist/components.cjs +157 -0
- package/dist/components.d.mts +291 -0
- package/dist/components.d.mts.map +1 -0
- package/dist/components.mjs +149 -0
- package/dist/index.cjs +417 -821
- package/dist/index.d.ts +677 -8103
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +365 -821
- package/dist/schemas.cjs +232 -0
- package/dist/schemas.d.mts +266 -0
- package/dist/schemas.d.mts.map +1 -0
- package/dist/schemas.mjs +182 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.mts +333 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -0
- package/package.json +51 -17
- package/.turbo/turbo-build.log +0 -14
- package/CHANGELOG.md +0 -7
- package/README.md +0 -11
- package/dist/index.d.cts +0 -8173
- package/dist/index.d.mts +0 -8173
- package/tsconfig.json +0 -19
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
function notEmpty(value) {
|
|
4
|
+
return value !== null && value !== undefined;
|
|
5
|
+
}
|
|
6
|
+
function compactObject(obj) {
|
|
7
|
+
return Object.fromEntries(Object.entries(obj).filter(([, value])=>notEmpty(value)));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async function client({ url, method, body, headers, pathParams, queryParams, signal, baseUrl = "", token = null, fetchImpl = fetch }) {
|
|
11
|
+
try {
|
|
12
|
+
const requestHeaders = compactObject({
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
Authorization: token ? `Bearer ${token}` : undefined,
|
|
15
|
+
...headers
|
|
16
|
+
});
|
|
17
|
+
if (requestHeaders["Content-Type"]?.toLowerCase().includes("multipart/form-data")) {
|
|
18
|
+
delete requestHeaders["Content-Type"];
|
|
19
|
+
}
|
|
20
|
+
const payload = body instanceof FormData ? body : requestHeaders["Content-Type"] === "application/json" ? JSON.stringify(body) : body;
|
|
21
|
+
const fullUrl = `${baseUrl}${resolveUrl(url, queryParams, pathParams)}`;
|
|
22
|
+
const response = await fetchImpl(fullUrl, {
|
|
23
|
+
signal,
|
|
24
|
+
method: method.toUpperCase(),
|
|
25
|
+
body: payload,
|
|
26
|
+
headers: requestHeaders
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
let error;
|
|
30
|
+
try {
|
|
31
|
+
error = await response.json();
|
|
32
|
+
} catch (e) {
|
|
33
|
+
error = {
|
|
34
|
+
status: "unknown",
|
|
35
|
+
payload: e instanceof Error ? `Unexpected error (${e.message})` : "Unexpected error"
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
if (response.headers?.get("content-type")?.includes("json")) {
|
|
41
|
+
return await response.json();
|
|
42
|
+
} else {
|
|
43
|
+
return await response.text();
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
const errorObject = {
|
|
47
|
+
name: "unknown",
|
|
48
|
+
message: e instanceof Error ? `Network error (${e.message})` : "Network error",
|
|
49
|
+
stack: e
|
|
50
|
+
};
|
|
51
|
+
throw errorObject;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const resolveUrl = (url, queryParams = {}, pathParams = {})=>{
|
|
55
|
+
let query = new URLSearchParams(queryParams).toString();
|
|
56
|
+
if (query) query = `?${query}`;
|
|
57
|
+
return url.replace(/\{\w*\}/g, (key)=>pathParams[key.slice(1, -1)] ?? "") + query;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @summary Create a Stripe Checkout session for API access
|
|
62
|
+
* @description Returns a Stripe Checkout URL. After payment, you'll receive an API key.
|
|
63
|
+
* @link /billing/checkout
|
|
64
|
+
*/ async function createCheckoutBillingCheckoutPost({ config } = {}) {
|
|
65
|
+
const { client: request = client, ...requestConfig } = config ?? {};
|
|
66
|
+
const data = await request({
|
|
67
|
+
method: "POST",
|
|
68
|
+
url: `/billing/checkout`,
|
|
69
|
+
...requestConfig,
|
|
70
|
+
headers: {
|
|
71
|
+
...requestConfig.headers
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @summary Check your free-tier usage
|
|
78
|
+
* @description See how many requests you've used today (free tier, by IP).
|
|
79
|
+
* @link /billing/usage
|
|
80
|
+
*/ async function checkUsageBillingUsageGet({ config } = {}) {
|
|
81
|
+
const { client: request = client, ...requestConfig } = config ?? {};
|
|
82
|
+
const data = await request({
|
|
83
|
+
method: "GET",
|
|
84
|
+
url: `/billing/usage`,
|
|
85
|
+
...requestConfig,
|
|
86
|
+
headers: {
|
|
87
|
+
...requestConfig.headers
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return data;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @summary List the full LiteLLM model catalog
|
|
94
|
+
* @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.
|
|
95
|
+
* @link /model_catalog
|
|
96
|
+
*/ async function listModelCatalogModelCatalogGet({ queryParams, config } = {}) {
|
|
97
|
+
const { client: request = client, ...requestConfig } = config ?? {};
|
|
98
|
+
const data = await request({
|
|
99
|
+
method: "GET",
|
|
100
|
+
url: `/model_catalog`,
|
|
101
|
+
queryParams,
|
|
102
|
+
...requestConfig,
|
|
103
|
+
headers: {
|
|
104
|
+
...requestConfig.headers
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return data;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @summary Get a single model from the catalog
|
|
111
|
+
* @description Returns detailed information for a specific model by its exact ID.
|
|
112
|
+
* @link /model_catalog/{model_id}
|
|
113
|
+
*/ async function getModelCatalogEntryModelCatalogModelIdGet({ pathParams, config } = {}) {
|
|
114
|
+
const { client: request = client, ...requestConfig } = config ?? {};
|
|
115
|
+
if (!pathParams.model_id) {
|
|
116
|
+
throw new Error(`Missing required path parameter: model_id`);
|
|
117
|
+
}
|
|
118
|
+
const data = await request({
|
|
119
|
+
method: "GET",
|
|
120
|
+
url: `/model_catalog/${pathParams.model_id}`,
|
|
121
|
+
...requestConfig,
|
|
122
|
+
headers: {
|
|
123
|
+
...requestConfig.headers
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return data;
|
|
127
|
+
}
|
|
128
|
+
const operationsByPath = {
|
|
129
|
+
"POST /billing/checkout": createCheckoutBillingCheckoutPost,
|
|
130
|
+
"GET /billing/usage": checkUsageBillingUsageGet,
|
|
131
|
+
"GET /model_catalog": listModelCatalogModelCatalogGet,
|
|
132
|
+
"GET /model_catalog/{model_id}": getModelCatalogEntryModelCatalogModelIdGet
|
|
133
|
+
};
|
|
134
|
+
const operationsByTag = {
|
|
135
|
+
"billing": {
|
|
136
|
+
createCheckoutBillingCheckoutPost,
|
|
137
|
+
checkUsageBillingUsageGet
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const tagDictionary = {
|
|
141
|
+
"billing": {
|
|
142
|
+
"POST": [
|
|
143
|
+
"createCheckoutBillingCheckoutPost"
|
|
144
|
+
],
|
|
145
|
+
"GET": [
|
|
146
|
+
"checkUsageBillingUsageGet"
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
exports.checkUsageBillingUsageGet = checkUsageBillingUsageGet;
|
|
152
|
+
exports.createCheckoutBillingCheckoutPost = createCheckoutBillingCheckoutPost;
|
|
153
|
+
exports.getModelCatalogEntryModelCatalogModelIdGet = getModelCatalogEntryModelCatalogModelIdGet;
|
|
154
|
+
exports.listModelCatalogModelCatalogGet = listModelCatalogModelCatalogGet;
|
|
155
|
+
exports.operationsByPath = operationsByPath;
|
|
156
|
+
exports.operationsByTag = operationsByTag;
|
|
157
|
+
exports.tagDictionary = tagDictionary;
|
|
@@ -0,0 +1,291 @@
|
|
|
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);
|
|
178
|
+
|
|
179
|
+
type RequestInit = {
|
|
180
|
+
body?: string | FormData | URLSearchParams | undefined;
|
|
181
|
+
headers?: Record<string, string> | undefined;
|
|
182
|
+
method?: string | undefined;
|
|
183
|
+
signal?: any | undefined;
|
|
184
|
+
};
|
|
185
|
+
type Response = {
|
|
186
|
+
ok: boolean;
|
|
187
|
+
status: number;
|
|
188
|
+
url: string;
|
|
189
|
+
json(): Promise<any>;
|
|
190
|
+
text(): Promise<string>;
|
|
191
|
+
headers?: {
|
|
192
|
+
get(name: string): string | null;
|
|
193
|
+
} | undefined;
|
|
194
|
+
};
|
|
195
|
+
type FetchImpl = (url: string, init?: RequestInit | undefined) => Promise<Response>;
|
|
196
|
+
|
|
197
|
+
type FetcherConfig = {
|
|
198
|
+
baseUrl?: string;
|
|
199
|
+
token?: string | null;
|
|
200
|
+
fetchImpl?: FetchImpl;
|
|
201
|
+
headers?: Record<string, any>;
|
|
202
|
+
};
|
|
203
|
+
type FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> = {
|
|
204
|
+
url: string;
|
|
205
|
+
method: string;
|
|
206
|
+
body?: TBody | undefined;
|
|
207
|
+
headers?: THeaders | undefined;
|
|
208
|
+
queryParams?: TQueryParams | undefined;
|
|
209
|
+
pathParams?: TPathParams | undefined;
|
|
210
|
+
signal?: AbortSignal | undefined;
|
|
211
|
+
} & FetcherConfig;
|
|
212
|
+
declare function client<TData, TError, TBody, THeaders, TQueryParams, TPathParams>({ url, method, body, headers, pathParams, queryParams, signal, baseUrl, token, fetchImpl, }: FetcherOptions<TBody, THeaders, TQueryParams, TPathParams>): Promise<TData>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @summary Create a Stripe Checkout session for API access
|
|
216
|
+
* @description Returns a Stripe Checkout URL. After payment, you'll receive an API key.
|
|
217
|
+
* @link /billing/checkout
|
|
218
|
+
*/
|
|
219
|
+
declare function createCheckoutBillingCheckoutPost({ config }?: {
|
|
220
|
+
config?: Partial<FetcherConfig> & {
|
|
221
|
+
client?: typeof client;
|
|
222
|
+
};
|
|
223
|
+
}): Promise<CheckoutResponse>;
|
|
224
|
+
/**
|
|
225
|
+
* @summary Check your free-tier usage
|
|
226
|
+
* @description See how many requests you've used today (free tier, by IP).
|
|
227
|
+
* @link /billing/usage
|
|
228
|
+
*/
|
|
229
|
+
declare function checkUsageBillingUsageGet({ config }?: {
|
|
230
|
+
config?: Partial<FetcherConfig> & {
|
|
231
|
+
client?: typeof client;
|
|
232
|
+
};
|
|
233
|
+
}): Promise<FreeTierResponse>;
|
|
234
|
+
/**
|
|
235
|
+
* @summary List the full LiteLLM model catalog
|
|
236
|
+
* @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
|
+
* @link /model_catalog
|
|
238
|
+
*/
|
|
239
|
+
declare function listModelCatalogModelCatalogGet({ queryParams, config }?: {
|
|
240
|
+
queryParams?: {
|
|
241
|
+
"provider"?: unknown;
|
|
242
|
+
"mode"?: unknown;
|
|
243
|
+
"model"?: unknown;
|
|
244
|
+
"supports_vision"?: unknown;
|
|
245
|
+
"supports_function_calling"?: unknown;
|
|
246
|
+
"supports_reasoning"?: unknown;
|
|
247
|
+
"supports_audio_input"?: unknown;
|
|
248
|
+
"supports_audio_output"?: unknown;
|
|
249
|
+
"supports_prompt_caching"?: unknown;
|
|
250
|
+
"supports_response_schema"?: unknown;
|
|
251
|
+
"page"?: number;
|
|
252
|
+
"page_size"?: number;
|
|
253
|
+
};
|
|
254
|
+
config?: Partial<FetcherConfig> & {
|
|
255
|
+
client?: typeof client;
|
|
256
|
+
};
|
|
257
|
+
}): Promise<ListModelCatalogModelCatalogGetResponse>;
|
|
258
|
+
/**
|
|
259
|
+
* @summary Get a single model from the catalog
|
|
260
|
+
* @description Returns detailed information for a specific model by its exact ID.
|
|
261
|
+
* @link /model_catalog/{model_id}
|
|
262
|
+
*/
|
|
263
|
+
declare function getModelCatalogEntryModelCatalogModelIdGet({ pathParams, config }?: {
|
|
264
|
+
pathParams: {
|
|
265
|
+
"model_id": string;
|
|
266
|
+
};
|
|
267
|
+
config?: Partial<FetcherConfig> & {
|
|
268
|
+
client?: typeof client;
|
|
269
|
+
};
|
|
270
|
+
}): Promise<GetModelCatalogEntryModelCatalogModelIdGetResponse>;
|
|
271
|
+
declare const operationsByPath: {
|
|
272
|
+
"POST /billing/checkout": typeof createCheckoutBillingCheckoutPost;
|
|
273
|
+
"GET /billing/usage": typeof checkUsageBillingUsageGet;
|
|
274
|
+
"GET /model_catalog": typeof listModelCatalogModelCatalogGet;
|
|
275
|
+
"GET /model_catalog/{model_id}": typeof getModelCatalogEntryModelCatalogModelIdGet;
|
|
276
|
+
};
|
|
277
|
+
declare const operationsByTag: {
|
|
278
|
+
billing: {
|
|
279
|
+
createCheckoutBillingCheckoutPost: typeof createCheckoutBillingCheckoutPost;
|
|
280
|
+
checkUsageBillingUsageGet: typeof checkUsageBillingUsageGet;
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
declare const tagDictionary: {
|
|
284
|
+
readonly billing: {
|
|
285
|
+
readonly POST: readonly ["createCheckoutBillingCheckoutPost"];
|
|
286
|
+
readonly GET: readonly ["checkUsageBillingUsageGet"];
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
export { checkUsageBillingUsageGet, createCheckoutBillingCheckoutPost, getModelCatalogEntryModelCatalogModelIdGet, listModelCatalogModelCatalogGet, operationsByPath, operationsByTag, tagDictionary };
|
|
291
|
+
//# sourceMappingURL=components.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.mts","sources":["../src/generated/types.ts","../src/utils/fetch.ts","../src/utils/fetcher.ts","../src/generated/components.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,gBAAgB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,gBAAgB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,eAAe;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,mBAAmB;AACxB;AACA;AACA;AACA,aAAa,eAAe;AAC5B;AACA;AACA;AACA;AACA;AACA,KAAK,iBAAiB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,wBAAwB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,iBAAiB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyFA;AACA;AACA;AACA;AACA,KAAK,wCAAwC,GAAG,wBAAwB;AACxE;AACA;AACA;AACA,KAAK,wCAAwC,GAAG,mBAAmB;AAqCnE;AACA;AACA;AACA,KAAK,uCAAuC,IAAI,wCAAwC,GAAG,wCAAwC;AAKnI;AACA;AACA;AACA;AACA,KAAK,mDAAmD,GAAG,iBAAiB;AAC5E;AACA;AACA;AACA,KAAK,mDAAmD,GAAG,mBAAmB;AA0B9E;AACA;AACA;AACA,KAAK,kDAAkD,IAAI,mDAAmD,GAAG,mDAAmD;;ACzUpK,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"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
function notEmpty(value) {
|
|
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 };
|