@bodhiapp/reference-api-types 0.0.5 → 0.0.7
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/index.d.ts +261 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -134,6 +134,30 @@ export interface GetModelQuery {
|
|
|
134
134
|
}
|
|
135
135
|
/** Response of the single-model endpoint: a Model with its `quants` table populated. */
|
|
136
136
|
export type GetModelResponse = Model;
|
|
137
|
+
/** A HuggingFace namespace is either an organization or a user account. */
|
|
138
|
+
export type NamespaceKind = 'org' | 'user';
|
|
139
|
+
/** One autocomplete suggestion for `GET /api/v1/namespaces`. */
|
|
140
|
+
export interface NamespaceSuggestion {
|
|
141
|
+
/** The handle used as the `{namespace}` in a `{namespace}/{repo}` path (e.g. "meta-llama"). */
|
|
142
|
+
name: string;
|
|
143
|
+
/** Display name, may differ from the handle (e.g. "Meta Llama"); null when HF omits it. */
|
|
144
|
+
fullname: string | null;
|
|
145
|
+
/** Absolute avatar URL (HF's relative ones are resolved to absolute); null when none. */
|
|
146
|
+
avatar_url: string | null;
|
|
147
|
+
kind: NamespaceKind;
|
|
148
|
+
}
|
|
149
|
+
/** Query parameters for `GET /api/v1/namespaces`. */
|
|
150
|
+
export interface ListNamespacesQuery {
|
|
151
|
+
/** Search prefix/substring the user is typing. Required. */
|
|
152
|
+
q: string;
|
|
153
|
+
/** Restrict to orgs or users. Omit to return both. */
|
|
154
|
+
kind?: NamespaceKind;
|
|
155
|
+
/** Max suggestions to return. 1–50, default 10. */
|
|
156
|
+
limit?: number;
|
|
157
|
+
}
|
|
158
|
+
export interface ListNamespacesResponse {
|
|
159
|
+
items: NamespaceSuggestion[];
|
|
160
|
+
}
|
|
137
161
|
export type ErrorCode = 'validation' | 'unauthorized' | 'not_found' | 'unsupported_source' | 'unsupported_type' | 'upstream' | 'internal';
|
|
138
162
|
/** Error envelope returned on non-2xx responses. */
|
|
139
163
|
export interface ErrorResponse {
|
|
@@ -149,3 +173,240 @@ export interface UpstreamErrorResponse {
|
|
|
149
173
|
status: number;
|
|
150
174
|
body: unknown;
|
|
151
175
|
}
|
|
176
|
+
export type Modality = 'text' | 'audio' | 'image' | 'video' | 'pdf';
|
|
177
|
+
/** Only real models.dev values; absent ⇒ "Stable" (synthesized by the UI). */
|
|
178
|
+
export type ModelStatus = 'alpha' | 'beta' | 'deprecated';
|
|
179
|
+
/** Derived from the boolean fields + modalities (`vision` = modalities_in includes 'image'). */
|
|
180
|
+
export type Capability = 'reasoning' | 'tool_call' | 'structured_output' | 'attachment' | 'vision';
|
|
181
|
+
/** The BodhiApp api_format the configure bridge can target. */
|
|
182
|
+
export type BridgeApiFormat = 'openai' | 'openai_responses' | 'anthropic' | 'anthropic_oauth' | 'gemini';
|
|
183
|
+
export type ProviderShape = 'openai' | 'openai-compatible' | 'anthropic' | 'openrouter' | 'kiro' | 'native';
|
|
184
|
+
export type ApiFormatHint = BridgeApiFormat | 'other';
|
|
185
|
+
/** Band-relevant pricing for list rows / served-by rows. null = field absent at source. */
|
|
186
|
+
export interface PricingLite {
|
|
187
|
+
input_per_m: number | null;
|
|
188
|
+
output_per_m: number | null;
|
|
189
|
+
cache_read_per_m: number | null;
|
|
190
|
+
cache_write_per_m: number | null;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Full unified pricing (model-detail). The opaque blob fields carry Portkey gap dimensions and are
|
|
194
|
+
* deferred — they ship `null`/absent in the models.dev-only release and are filled later without a
|
|
195
|
+
* breaking change.
|
|
196
|
+
*/
|
|
197
|
+
export interface Pricing extends PricingLite {
|
|
198
|
+
currency: string;
|
|
199
|
+
reasoning_per_m: number | null;
|
|
200
|
+
input_audio_per_m: number | null;
|
|
201
|
+
output_audio_per_m: number | null;
|
|
202
|
+
/** Deferred Portkey-gap blobs; present-but-null until Portkey enrichment lands. */
|
|
203
|
+
cache_write_1h_per_m?: number | null;
|
|
204
|
+
context_over_200k?: unknown | null;
|
|
205
|
+
batch?: unknown | null;
|
|
206
|
+
finetune?: unknown | null;
|
|
207
|
+
tool_surcharges?: unknown | null;
|
|
208
|
+
image_pricing?: unknown | null;
|
|
209
|
+
video_pricing?: unknown | null;
|
|
210
|
+
custom_pricing?: unknown | null;
|
|
211
|
+
calculate?: unknown | null;
|
|
212
|
+
/** Which source filled this row. */
|
|
213
|
+
pricing_source: 'modelsdev' | 'portkey' | 'both' | null;
|
|
214
|
+
/** Deferred; whether filled from Portkey's per-provider `default` fallback. */
|
|
215
|
+
portkey_default_used?: boolean;
|
|
216
|
+
}
|
|
217
|
+
export interface PageMeta {
|
|
218
|
+
page: number;
|
|
219
|
+
page_size: number;
|
|
220
|
+
total: number;
|
|
221
|
+
}
|
|
222
|
+
/** value → count over the current (post-filter, pre-pagination) result set. */
|
|
223
|
+
export type FacetBucket = Record<string, number>;
|
|
224
|
+
export interface ModelFacets {
|
|
225
|
+
capability: FacetBucket;
|
|
226
|
+
modality: FacetBucket;
|
|
227
|
+
/** keys: alpha|beta|deprecated|stable (stable = status absent). */
|
|
228
|
+
status: FacetBucket;
|
|
229
|
+
/** provider slug → model count. */
|
|
230
|
+
provider: FacetBucket;
|
|
231
|
+
/** keys: open|closed. */
|
|
232
|
+
open_weights: FacetBucket;
|
|
233
|
+
}
|
|
234
|
+
export interface ConfigureBridge {
|
|
235
|
+
api_format: BridgeApiFormat;
|
|
236
|
+
/** models.dev `api` when present, else a BodhiApp preset; null ⇒ the form shows "base URL required". */
|
|
237
|
+
base_url: string | null;
|
|
238
|
+
base_url_source: 'modelsdev_api' | 'bodhi_preset' | 'user_required';
|
|
239
|
+
/** Bedrock's `api` is a literal AWS_REGION placeholder — flag it. */
|
|
240
|
+
base_url_requires_substitution: boolean;
|
|
241
|
+
}
|
|
242
|
+
export interface ProviderSummary {
|
|
243
|
+
slug: string;
|
|
244
|
+
name: string;
|
|
245
|
+
/** Served from our own R2 (images.<env>-api.getbodhi.app); null ⇒ UI falls back to a monogram. */
|
|
246
|
+
logo_url: string | null;
|
|
247
|
+
model_count: number;
|
|
248
|
+
/** 1-based, by model_count desc. */
|
|
249
|
+
rank: number;
|
|
250
|
+
/** models.dev `api`; null for native providers (the bridge fills from a BodhiApp preset). */
|
|
251
|
+
api_base_url: string | null;
|
|
252
|
+
provider_shape: ProviderShape;
|
|
253
|
+
api_format_hint: ApiFormatHint;
|
|
254
|
+
/** Union of capability flags across the provider's models. */
|
|
255
|
+
capabilities_summary: Capability[];
|
|
256
|
+
pricing_summary: {
|
|
257
|
+
min_in_per_m: number | null;
|
|
258
|
+
min_out_per_m: number | null;
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
export interface ProviderListResponse extends PageMeta {
|
|
262
|
+
items: ProviderSummary[];
|
|
263
|
+
facets: {
|
|
264
|
+
capability: FacetBucket;
|
|
265
|
+
api_format: FacetBucket;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
export interface ProviderDetailResponse {
|
|
269
|
+
slug: string;
|
|
270
|
+
name: string;
|
|
271
|
+
logo_url: string | null;
|
|
272
|
+
model_count: number;
|
|
273
|
+
/** credential env var names, e.g. ["ANTHROPIC_API_KEY"]. */
|
|
274
|
+
env: string[];
|
|
275
|
+
npm: string | null;
|
|
276
|
+
doc_url: string | null;
|
|
277
|
+
api_base_url: string | null;
|
|
278
|
+
provider_shape: ProviderShape;
|
|
279
|
+
bridge: ConfigureBridge;
|
|
280
|
+
}
|
|
281
|
+
/** Sort direction; applied on top of each sort key's natural default. */
|
|
282
|
+
export type SortOrder = 'asc' | 'desc';
|
|
283
|
+
export interface ListProvidersQuery {
|
|
284
|
+
q?: string;
|
|
285
|
+
/** Repeatable; AND. */
|
|
286
|
+
capability?: Capability | Capability[];
|
|
287
|
+
api_format?: ApiFormatHint | ApiFormatHint[];
|
|
288
|
+
/** Min input price ($/1M) across the provider's models. */
|
|
289
|
+
pricing_max?: number;
|
|
290
|
+
/** "free" = cheapest model is $0; "paid" = has a positive price. */
|
|
291
|
+
pricing?: 'free' | 'paid';
|
|
292
|
+
/** Defaults: rank/model_count desc, name/api_format asc, pricing asc (free first). */
|
|
293
|
+
sort?: 'rank' | 'name' | 'model_count' | 'api_format' | 'pricing';
|
|
294
|
+
order?: SortOrder;
|
|
295
|
+
page?: number;
|
|
296
|
+
page_size?: number;
|
|
297
|
+
}
|
|
298
|
+
export interface ProviderModelRow {
|
|
299
|
+
model_id: string;
|
|
300
|
+
name: string;
|
|
301
|
+
caps: Capability[];
|
|
302
|
+
context_limit: number | null;
|
|
303
|
+
output_limit: number | null;
|
|
304
|
+
pricing: PricingLite;
|
|
305
|
+
status: ModelStatus | null;
|
|
306
|
+
modalities_in: Modality[];
|
|
307
|
+
modalities_out: Modality[];
|
|
308
|
+
}
|
|
309
|
+
export interface ProviderModelsResponse {
|
|
310
|
+
items: ProviderModelRow[];
|
|
311
|
+
total: number;
|
|
312
|
+
}
|
|
313
|
+
export interface ListProviderModelsQuery {
|
|
314
|
+
/** Defaults: context desc, name asc, price asc. */
|
|
315
|
+
sort?: 'name' | 'context' | 'price';
|
|
316
|
+
order?: SortOrder;
|
|
317
|
+
}
|
|
318
|
+
/** One logical model (serving rows grouped by canonical_id). `slug`/`model_id`/`pricing` are the
|
|
319
|
+
* primary (cheapest input_per_m) provider in the group. */
|
|
320
|
+
export interface ModelLite {
|
|
321
|
+
slug: string;
|
|
322
|
+
model_id: string;
|
|
323
|
+
name: string;
|
|
324
|
+
family: string | null;
|
|
325
|
+
context_limit: number | null;
|
|
326
|
+
output_limit: number | null;
|
|
327
|
+
pricing: PricingLite;
|
|
328
|
+
caps: Capability[];
|
|
329
|
+
status: ModelStatus | null;
|
|
330
|
+
open_weights: boolean;
|
|
331
|
+
modalities_in: Modality[];
|
|
332
|
+
modalities_out: Modality[];
|
|
333
|
+
/** COUNT(DISTINCT provider_slug) in the canonical_id group. */
|
|
334
|
+
provider_count: number;
|
|
335
|
+
release_date: string | null;
|
|
336
|
+
last_updated: string | null;
|
|
337
|
+
}
|
|
338
|
+
export interface ListCatalogModelsQuery {
|
|
339
|
+
q?: string;
|
|
340
|
+
/** Repeatable; AND. */
|
|
341
|
+
capability?: Capability | Capability[];
|
|
342
|
+
/** Repeatable; OR. Matches modalities_in ∪ modalities_out. */
|
|
343
|
+
modality?: Modality | Modality[];
|
|
344
|
+
/** Max input price ($/1M). */
|
|
345
|
+
pricing_max?: number;
|
|
346
|
+
/** Min input price ($/1M). */
|
|
347
|
+
pricing_min?: number;
|
|
348
|
+
/** Max output price ($/1M). */
|
|
349
|
+
pricing_out_max?: number;
|
|
350
|
+
pricing_band?: 'free' | 'low' | 'mid' | 'high';
|
|
351
|
+
context_min?: number;
|
|
352
|
+
/** Repeatable. "stable" selects rows whose status is ABSENT. */
|
|
353
|
+
status?: ('alpha' | 'beta' | 'deprecated' | 'stable') | ('alpha' | 'beta' | 'deprecated' | 'stable')[];
|
|
354
|
+
/** Repeatable; OR. */
|
|
355
|
+
provider?: string | string[];
|
|
356
|
+
/** Repeatable; OR. Case-insensitive match on the model family. */
|
|
357
|
+
family?: string | string[];
|
|
358
|
+
open_weights?: 'open' | 'closed';
|
|
359
|
+
/** "relevance" ranks by full-text match (bm25); only meaningful with `q`. Default "updated".
|
|
360
|
+
* "price"/"price_out" sort by input/output price. */
|
|
361
|
+
sort?: 'relevance' | 'updated' | 'context' | 'price' | 'price_out' | 'name' | 'family' | 'providers';
|
|
362
|
+
/** Defaults: name/family asc, price/price_out asc, context/providers/updated/relevance desc. */
|
|
363
|
+
order?: SortOrder;
|
|
364
|
+
page?: number;
|
|
365
|
+
page_size?: number;
|
|
366
|
+
}
|
|
367
|
+
export interface ModelsListResponse extends PageMeta {
|
|
368
|
+
items: ModelLite[];
|
|
369
|
+
facets: ModelFacets;
|
|
370
|
+
}
|
|
371
|
+
export interface ServedBy {
|
|
372
|
+
slug: string;
|
|
373
|
+
name: string;
|
|
374
|
+
logo_url: string | null;
|
|
375
|
+
base_url: string | null;
|
|
376
|
+
pricing: PricingLite;
|
|
377
|
+
}
|
|
378
|
+
export interface ModelDetailResponse {
|
|
379
|
+
/** primary/representative provider of the canonical_id group. */
|
|
380
|
+
slug: string;
|
|
381
|
+
model_id: string;
|
|
382
|
+
name: string;
|
|
383
|
+
family: string | null;
|
|
384
|
+
status: ModelStatus | null;
|
|
385
|
+
reasoning: boolean;
|
|
386
|
+
tool_call: boolean;
|
|
387
|
+
structured_output: boolean | null;
|
|
388
|
+
attachment: boolean;
|
|
389
|
+
open_weights: boolean;
|
|
390
|
+
temperature: boolean | number | null;
|
|
391
|
+
reasoning_options: unknown | null;
|
|
392
|
+
context_limit: number | null;
|
|
393
|
+
output_limit: number | null;
|
|
394
|
+
modalities_in: Modality[];
|
|
395
|
+
modalities_out: Modality[];
|
|
396
|
+
release_date: string | null;
|
|
397
|
+
last_updated: string | null;
|
|
398
|
+
knowledge_cutoff: string | null;
|
|
399
|
+
pricing: Pricing;
|
|
400
|
+
/** Enrichment (models.json) — deferred with Portkey; null in the models.dev-only release. */
|
|
401
|
+
license: string | null;
|
|
402
|
+
links: unknown | null;
|
|
403
|
+
weights: unknown | null;
|
|
404
|
+
benchmarks: unknown | null;
|
|
405
|
+
/** The other serving rows in the same canonical_id group, each with its own price. */
|
|
406
|
+
served_by: ServedBy[];
|
|
407
|
+
bridge: ConfigureBridge;
|
|
408
|
+
}
|
|
409
|
+
export interface GetCatalogModelQuery {
|
|
410
|
+
/** reserved */
|
|
411
|
+
include?: string;
|
|
412
|
+
}
|
package/package.json
CHANGED