@bodhiapp/reference-api-types
v0.0.12
Published
TypeScript request/response types for the Bodhi Models Reference API (types only — no runtime).
Readme
@bodhiapp/reference-api-types
TypeScript request/response types for the Bodhi Models Reference API — the v1 live HuggingFace proxy for local (GGUF) models.
Types only. This package ships no runtime — no fetch/axios wrapper, no HTTP client. It
exports interfaces so you can type your own requests and responses. Use your existing client (e.g.
BodhiApp's referenceApiClient.ts) and annotate it with these types.
These types are the single source of truth: the API server imports the same definitions, so the published types cannot drift from the wire shapes.
Install
npm install @bodhiapp/reference-api-typesUsage
import type {
Model,
ListModelsQuery,
ListModelsResponse,
GetModelResponse,
ErrorResponse,
} from '@bodhiapp/reference-api-types'
// Type a list request + response (you bring your own fetch).
async function listModels(client: { get<T>(path: string): Promise<T> }, query: ListModelsQuery) {
const qs = new URLSearchParams(query as Record<string, string>).toString()
return client.get<ListModelsResponse>(`/api/v1/models?${qs}`)
}
// Type a single-model response (includes the quants[] table).
async function getModel(client: { get<T>(path: string): Promise<T> }, ns: string, repo: string) {
return client.get<GetModelResponse>(`/api/v1/models/huggingface/${ns}/${repo}`)
}Exports
| Type | For |
|---|---|
| Model, Quant | the model DTO + its quantization entries |
| ListModelsQuery | query params for GET /api/v1/models |
| ListModelsResponse | response of the list endpoint |
| GetModelQuery, GetModelResponse | the single-model endpoint |
| ErrorResponse, ErrorCode | the error envelope |
| ModelType, ModelSource, Specialisation, SortKey, SortOrder | the supported enum values |
For the full API contract (semantics, auth, pagination, recipes) see docs/functional/ in the
api-getbodhi-app repo, or the live OpenAPI doc at
/api/openapi.json (Swagger UI at /api/doc).
Release
Published from local via just publish-api-types (version = next patch from npmjs). See the repo's
justfile and scripts/release.sh.
