import { APIResource } from "../core/resource.mjs"; import * as ModelsAPI from "./models.mjs"; import * as CompletionsAPI from "./chat/completions.mjs"; import { APIPromise } from "../core/api-promise.mjs"; import { CursorPage, type CursorPageParams, PagePromise } from "../core/pagination.mjs"; import { RequestOptions } from "../internal/request-options.mjs"; export declare class Models extends APIResource { /** * Create a custom model record in your account and begin deploying it through a * supported serving vendor. * * A model here is a record for a model you deploy and serve through Scale's own * inference vendors: only the `launch` and `llmengine` vendors are accepted and * any other vendor is rejected. This is distinct from * `GET /v5/chat/completions/models`, which lists the models already available to * call for chat completions rather than creating or managing these records. The * call is asynchronous — the record is created in a deploying status, a deployment * job is recorded, and a Temporal workflow is started to perform the deployment, * so the model is not ready for inference when this returns. A model name must be * unique per vendor within your account; if a model with the same name and vendor * already exists the request fails unless `on_conflict` is set to `update`, in * which case the existing model is updated instead. */ create(params: ModelCreateParams, options?: RequestOptions): APIPromise; /** * Retrieve a single custom model record by its ID. * * Returns the model record — including its vendor, configuration, and current * deployment status — for a model managed through this API and owned by the * caller's account. This is distinct from `GET /v5/chat/completions/models`, which * lists the models available to call for chat completions rather than returning a * single managed record. */ retrieve(modelID: string, options?: RequestOptions): APIPromise; /** * Update a custom model record; vendor-configuration changes are applied * asynchronously by redeploying the model. * * This supports three kinds of update: changing model metadata only, renaming the * model, and changing the vendor configuration. A vendor-configuration change is * asynchronous — it puts the model back into a deploying status, records an update * job, and starts a Temporal workflow to redeploy, so the new configuration is not * live when this returns; metadata-only and rename changes take effect * immediately. The vendor configuration supplied must match the model's own vendor * (`launch` or `llmengine`), and only those two vendors are supported. A model * that is currently deploying cannot be modified and the request fails until * deployment finishes. When renaming with `on_conflict` set to `swap`, the name is * exchanged with an existing model of the same name and vendor instead of failing * on the uniqueness constraint. */ update(modelID: string, params: ModelUpdateParams, options?: RequestOptions): APIPromise; /** * List the custom model records registered in your account. * * Returns a paginated list of the model records managed through this API — models * your account deploys through the `launch` or `llmengine` serving vendors — * optionally filtered by name and by model vendor, and scoped to the caller's * account. This is different from `GET /v5/chat/completions/models`, which lists * the models available to invoke for chat completions; this endpoint returns the * managed records along with their deployment status, not the catalog of callable * completion models. */ list(query?: ModelListParams | null | undefined, options?: RequestOptions): PagePromise; /** * Permanently delete a custom model record and tear down its deployment at the * serving vendor. * * This is a hard delete: the model row is removed from your account entirely and * cannot be restored afterward. Before the record is removed, if the model has an * associated vendor deployment that deployment is torn down at its serving vendor. * A model that is currently deploying cannot be deleted and the request fails * until deployment finishes. This operates on the model records managed by this * API, distinct from the `GET /v5/chat/completions/models` catalog of models * callable for chat completions. */ delete(modelID: string, options?: RequestOptions): APIPromise; } export type InferenceModelsCursorPage = CursorPage; export interface InferenceModel { /** * The unique identifier of the entity. */ id: string; /** * The date and time when the entity was created in ISO format. */ created_at: string; /** * The type of identity that created the entity. */ created_by_identity_type: 'user' | 'service_account'; /** * The user who originally created the entity. */ created_by_user_id: string; model_type: InferenceModelType; model_vendor: CompletionsAPI.InferenceModelVendor; name: string; status: 'failed' | 'ready' | 'deploying' | 'deployment_timeout'; model_availability?: InferenceModelAvailability; model_metadata?: { [key: string]: unknown; }; object?: 'model'; status_reason?: string; vendor_configuration?: LaunchVendorConfiguration | LlmEngineVendorConfiguration; } export type InferenceModelAvailability = 'unknown' | 'available' | 'unavailable'; export type InferenceModelType = 'generic' | 'completion' | 'chat_completion'; export interface LaunchVendorConfiguration { model_image: LaunchVendorConfiguration.ModelImage; model_infra: LaunchVendorConfiguration.ModelInfra; } export declare namespace LaunchVendorConfiguration { interface ModelImage { command: Array; registry: string; repository: string; tag: string; env_vars?: { [key: string]: unknown; }; healthcheck_route?: string; predict_route?: string; readiness_delay?: number; request_schema?: { [key: string]: unknown; }; response_schema?: { [key: string]: unknown; }; streaming_command?: Array; streaming_predict_route?: string; } interface ModelInfra { cpus?: string | number; endpoint_type?: 'async' | 'sync' | 'streaming'; gpu_type?: 'nvidia-tesla-t4' | 'nvidia-ampere-a10' | 'nvidia-ampere-a100' | 'nvidia-ampere-a100e' | 'nvidia-hopper-h100' | 'nvidia-hopper-h100-1g20gb' | 'nvidia-hopper-h100-3g40gb'; gpus?: number; high_priority?: boolean; labels?: { [key: string]: string; }; max_workers?: number; memory?: string; min_workers?: number; per_worker?: number; public_inference?: boolean; storage?: string; } } export interface LlmEngineVendorConfiguration { model: string; chat_template_override?: string; checkpoint_path?: string; cpus?: number; default_callback_url?: string; endpoint_type?: string; gpu_type?: string; gpus?: number; high_priority?: boolean; inference_framework?: string; inference_framework_image_tag?: string; labels?: { [key: string]: string; }; max_workers?: number; memory?: string; min_workers?: number; nodes_per_worker?: number; num_shards?: number; per_worker?: number; post_inference_hooks?: Array; public_inference?: boolean; quantize?: string; source?: string; storage?: string; [k: string]: unknown; } export interface ModelDeleteResponse { id: string; deleted: boolean; object?: 'model'; } export interface ModelCreateParams { /** * Register a model already served by an external / proxy-served vendor (e.g. an * OpenAI-compatible self-hosted model behind the inference proxy). * * Unlike launch/llmengine, no Scale-side deployment is performed: the record is * created READY and is immediately callable via /v5/chat/completions. Accepted * only when NATIVE_OPENAI_INFERENCE_GATEWAY is enabled. The discriminator * (model_vendor) covers every vendor except launch/llmengine, and no * vendor_configuration applies. */ model: ModelCreateParams.LaunchModelCreateRequest | ModelCreateParams.LlmEngineModelCreateRequest | ModelCreateParams.HostedModelCreateRequest; } export declare namespace ModelCreateParams { interface LaunchModelCreateRequest { /** * Unique name to reference your model */ name: string; vendor_configuration: ModelsAPI.LaunchVendorConfiguration; model_metadata?: { [key: string]: unknown; }; model_type?: 'generic'; model_vendor?: 'launch'; on_conflict?: 'error' | 'update'; } interface LlmEngineModelCreateRequest { /** * Unique name to reference your model */ name: string; vendor_configuration: ModelsAPI.LlmEngineVendorConfiguration; model_metadata?: { [key: string]: unknown; }; model_type?: 'chat_completion'; model_vendor?: 'llmengine'; on_conflict?: 'error' | 'update'; } /** * Register a model already served by an external / proxy-served vendor (e.g. an * OpenAI-compatible self-hosted model behind the inference proxy). * * Unlike launch/llmengine, no Scale-side deployment is performed: the record is * created READY and is immediately callable via /v5/chat/completions. Accepted * only when NATIVE_OPENAI_INFERENCE_GATEWAY is enabled. The discriminator * (model_vendor) covers every vendor except launch/llmengine, and no * vendor_configuration applies. */ interface HostedModelCreateRequest { /** * Type of model, for example `chat_completion` */ model_type: ModelsAPI.InferenceModelType; /** * Vendor to serve/create model */ model_vendor: 'openai' | 'cohere' | 'vertex_ai' | 'anthropic' | 'azure' | 'gemini' | 'model_zoo' | 'bedrock' | 'xai' | 'fireworks_ai'; /** * Unique name to reference your model */ name: string; model_metadata?: { [key: string]: unknown; }; on_conflict?: 'error' | 'update'; } } export interface ModelUpdateParams { model: ModelUpdateParams.DefaultModelPatchRequest | ModelUpdateParams.ModelConfigurationPatchRequest | ModelUpdateParams.SwapNamesModelPatchRequest; } export declare namespace ModelUpdateParams { interface DefaultModelPatchRequest { model_metadata?: { [key: string]: unknown; }; } interface ModelConfigurationPatchRequest { vendor_configuration: ModelConfigurationPatchRequest.PartialLaunchVendorConfiguration | ModelConfigurationPatchRequest.PartialLlmEngineVendorConfiguration; model_metadata?: { [key: string]: unknown; }; } namespace ModelConfigurationPatchRequest { interface PartialLaunchVendorConfiguration { model_image?: PartialLaunchVendorConfiguration.ModelImage; model_infra?: PartialLaunchVendorConfiguration.ModelInfra; } namespace PartialLaunchVendorConfiguration { interface ModelImage { command?: Array; env_vars?: { [key: string]: unknown; }; healthcheck_route?: string; predict_route?: string; readiness_delay?: number; registry?: string; repository?: string; request_schema?: { [key: string]: unknown; }; response_schema?: { [key: string]: unknown; }; streaming_command?: Array; streaming_predict_route?: string; tag?: string; } interface ModelInfra { cpus?: string | number; endpoint_type?: 'async' | 'sync' | 'streaming'; gpu_type?: 'nvidia-tesla-t4' | 'nvidia-ampere-a10' | 'nvidia-ampere-a100' | 'nvidia-ampere-a100e' | 'nvidia-hopper-h100' | 'nvidia-hopper-h100-1g20gb' | 'nvidia-hopper-h100-3g40gb'; gpus?: number; high_priority?: boolean; labels?: { [key: string]: string; }; max_workers?: number; memory?: string; min_workers?: number; per_worker?: number; public_inference?: boolean; storage?: string; } } interface PartialLlmEngineVendorConfiguration { chat_template_override?: string; checkpoint_path?: string; cpus?: number; default_callback_url?: string; endpoint_type?: string; gpu_type?: string; gpus?: number; high_priority?: boolean; inference_framework?: string; inference_framework_image_tag?: string; labels?: { [key: string]: string; }; max_workers?: number; memory?: string; min_workers?: number; model?: string; nodes_per_worker?: number; num_shards?: number; per_worker?: number; post_inference_hooks?: Array; public_inference?: boolean; quantize?: string; source?: string; storage?: string; } } interface SwapNamesModelPatchRequest { name: string; on_conflict?: 'error' | 'swap'; } } export interface ModelListParams extends CursorPageParams { model_vendor?: CompletionsAPI.InferenceModelVendor; name?: string; sort_by?: string; sort_order?: CompletionsAPI.SortOrder; } export declare namespace Models { export { type InferenceModel as InferenceModel, type InferenceModelAvailability as InferenceModelAvailability, type InferenceModelType as InferenceModelType, type LaunchVendorConfiguration as LaunchVendorConfiguration, type LlmEngineVendorConfiguration as LlmEngineVendorConfiguration, type ModelDeleteResponse as ModelDeleteResponse, type InferenceModelsCursorPage as InferenceModelsCursorPage, type ModelCreateParams as ModelCreateParams, type ModelUpdateParams as ModelUpdateParams, type ModelListParams as ModelListParams, }; } //# sourceMappingURL=models.d.mts.map