listModels method
List models
Cost: 5-300+ credits, stepped by returned rows and multiplied by 1 + (offset/2500)². A filtered lookup up to 200 rows costs 5; a 1000-row page on the first page costs 300; on offset=10000, 5100. Filter cheap, dump expensive. See /api#pricing. Delisted models are excluded by default (delisted=live); pass delisted=dead|all to include tombstoned records. A dedicated change-stream endpoint is at GET /api/v1/models/delisted.
Parameters:
-
String method: M-code, case-insensitive. See GET /api/v1/methods.
-
String family: Base family, for example qwen or llama.
-
String author: Publisher handle, case-insensitive.
-
String license: SPDX-ish license string as published.
-
int downloadsGte:
-
int downloadsLte:
-
String createdAfter: ISO-8601 date or timestamp, inclusive.
-
String createdBefore: ISO-8601 date or timestamp, inclusive.
-
String delisted: Tombstone filter.
live(default): HF-visible models only.dead: delisted-only (same shape as this endpoint plus is_delisted=1 and last_seen_at).all: both, in one page. For a purpose-built change-stream feed, prefer GET /api/v1/models/delisted. -
String sort: Bare key is the natural direction (downloads/likes = most first, dates = newest first). A leading
-flips it.createdandfirst_seenare aliases for the full column names. -
int limit: Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
-
int offset: Rows to skip. Negative and non-numeric values are treated as 0.
Implementation
Future<ListModels200Response?> listModels({ String? method, String? family, String? author, String? license, int? downloadsGte, int? downloadsLte, String? createdAfter, String? createdBefore, String? delisted, String? sort, int? limit, int? offset, Future<void>? abortTrigger, }) async {
final response = await listModelsWithHttpInfo(method: method, family: family, author: author, license: license, downloadsGte: downloadsGte, downloadsLte: downloadsLte, createdAfter: createdAfter, createdBefore: createdBefore, delisted: delisted, sort: sort, limit: limit, offset: offset, abortTrigger: abortTrigger,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ListModels200Response',) as ListModels200Response;
}
return null;
}