notdiamond
Version:
The official TypeScript library for the Notdiamond API
45 lines • 1.68 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../core/resource.mjs";
export class Models extends APIResource {
/**
* List all supported text generation models with optional filtering.
*
* including pricing, context length, latency, and OpenRouter availability.
*
* **Note:** Image generation models are excluded from this endpoint.
*
* **Examples:**
*
* - Get all models: `/v2/models`
* - OpenRouter only: `/v2/models?openrouter_only=true`
* - Specific provider: `/v2/models?provider=openai`
* - Multiple providers: `/v2/models?provider=openai&provider=anthropic`
*
* **Query Parameters:**
*
* - **provider**: Filter by provider name(s). Can specify multiple times for
* multiple providers (e.g., `?provider=openai&provider=anthropic`)
* - **openrouter_only**: Return only models that have OpenRouter support (default:
* false)
*
* **Returns:**
*
* - **models**: List of active text generation model objects with metadata
* - **total**: Total number of active models returned
* - **deprecated_models**: List of deprecated text generation model objects with
* metadata (respects the same filters as active models)
*
* **Caching:**
*
* - Response is cacheable for 1 hour (model list rarely changes)
*
* @example
* ```ts
* const models = await client.models.list();
* ```
*/
list(query = {}, options) {
return this._client.get('/v2/models', { query, ...options });
}
}
//# sourceMappingURL=models.mjs.map