import { APIResource } from "../../core/resource.js"; import * as PredictionsAPI from "./predictions.js"; import { PredictionCreateParams, Predictions } from "./predictions.js"; import { APIPromise } from "../../core/api-promise.js"; import { CursorURLPage, PagePromise } from "../../core/pagination.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class Deployments extends APIResource { predictions: PredictionsAPI.Predictions; /** * Create a new deployment: * * Example cURL request: * * ```console * curl -s \ * -X POST \ * -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ * -H "Content-Type: application/json" \ * -d '{ * "name": "my-app-image-generator", * "model": "stability-ai/sdxl", * "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf", * "hardware": "gpu-t4", * "min_instances": 0, * "max_instances": 3 * }' \ * https://api.replicate.com/v1/deployments * ``` * * The response will be a JSON object describing the deployment: * * ```json * { * "owner": "acme", * "name": "my-app-image-generator", * "current_release": { * "number": 1, * "model": "stability-ai/sdxl", * "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf", * "created_at": "2024-02-15T16:32:57.018467Z", * "created_by": { * "type": "organization", * "username": "acme", * "name": "Acme Corp, Inc.", * "avatar_url": "https://cdn.replicate.com/avatars/acme.png", * "github_url": "https://github.com/acme" * }, * "configuration": { * "hardware": "gpu-t4", * "min_instances": 1, * "max_instances": 5 * } * } * } * ``` */ create(body: DeploymentCreateParams, options?: RequestOptions): APIPromise; /** * Update properties of an existing deployment, including hardware, min/max * instances, and the deployment's underlying model * [version](https://replicate.com/docs/how-does-replicate-work#versions). * * Example cURL request: * * ```console * curl -s \ * -X PATCH \ * -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ * -H "Content-Type: application/json" \ * -d '{"min_instances": 3, "max_instances": 10}' \ * https://api.replicate.com/v1/deployments/acme/my-app-image-generator * ``` * * The response will be a JSON object describing the deployment: * * ```json * { * "owner": "acme", * "name": "my-app-image-generator", * "current_release": { * "number": 2, * "model": "stability-ai/sdxl", * "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf", * "created_at": "2024-02-15T16:32:57.018467Z", * "created_by": { * "type": "organization", * "username": "acme", * "name": "Acme Corp, Inc.", * "avatar_url": "https://cdn.replicate.com/avatars/acme.png", * "github_url": "https://github.com/acme" * }, * "configuration": { * "hardware": "gpu-t4", * "min_instances": 3, * "max_instances": 10 * } * } * } * ``` * * Updating any deployment properties will increment the `number` field of the * `current_release`. */ update(params: DeploymentUpdateParams, options?: RequestOptions): APIPromise; /** * Get a list of deployments associated with the current account, including the * latest release configuration for each deployment. * * Example cURL request: * * ```console * curl -s \ * -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ * https://api.replicate.com/v1/deployments * ``` * * The response will be a paginated JSON array of deployment objects, sorted with * the most recent deployment first: * * ```json * { * "next": "http://api.replicate.com/v1/deployments?cursor=cD0yMDIzLTA2LTA2KzIzJTNBNDAlM0EwOC45NjMwMDAlMkIwMCUzQTAw", * "previous": null, * "results": [ * { * "owner": "replicate", * "name": "my-app-image-generator", * "current_release": { * "number": 1, * "model": "stability-ai/sdxl", * "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf", * "created_at": "2024-02-15T16:32:57.018467Z", * "created_by": { * "type": "organization", * "username": "acme", * "name": "Acme Corp, Inc.", * "avatar_url": "https://cdn.replicate.com/avatars/acme.png", * "github_url": "https://github.com/acme" * }, * "configuration": { * "hardware": "gpu-t4", * "min_instances": 1, * "max_instances": 5 * } * } * } * ] * } * ``` */ list(options?: RequestOptions): PagePromise; /** * Delete a deployment * * Deployment deletion has some restrictions: * * - You can only delete deployments that have been offline and unused for at least * 15 minutes. * * Example cURL request: * * ```command * curl -s -X DELETE \ * -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ * https://api.replicate.com/v1/deployments/acme/my-app-image-generator * ``` * * The response will be an empty 204, indicating the deployment has been deleted. */ delete(params: DeploymentDeleteParams, options?: RequestOptions): APIPromise; /** * Get information about a deployment by name including the current release. * * Example cURL request: * * ```console * curl -s \ * -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ * https://api.replicate.com/v1/deployments/replicate/my-app-image-generator * ``` * * The response will be a JSON object describing the deployment: * * ```json * { * "owner": "acme", * "name": "my-app-image-generator", * "current_release": { * "number": 1, * "model": "stability-ai/sdxl", * "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf", * "created_at": "2024-02-15T16:32:57.018467Z", * "created_by": { * "type": "organization", * "username": "acme", * "name": "Acme Corp, Inc.", * "avatar_url": "https://cdn.replicate.com/avatars/acme.png", * "github_url": "https://github.com/acme" * }, * "configuration": { * "hardware": "gpu-t4", * "min_instances": 1, * "max_instances": 5 * } * } * } * ``` */ get(params: DeploymentGetParams, options?: RequestOptions): APIPromise; } export type DeploymentListResponsesCursorURLPage = CursorURLPage; export interface DeploymentCreateResponse { current_release?: DeploymentCreateResponse.CurrentRelease; /** * The name of the deployment. */ name?: string; /** * The owner of the deployment. */ owner?: string; } export declare namespace DeploymentCreateResponse { interface CurrentRelease { configuration?: CurrentRelease.Configuration; /** * The time the release was created. */ created_at?: string; created_by?: CurrentRelease.CreatedBy; /** * The model identifier string in the format of `{model_owner}/{model_name}`. */ model?: string; /** * The release number. */ number?: number; /** * The ID of the model version used in the release. */ version?: string; } namespace CurrentRelease { interface Configuration { /** * The SKU for the hardware used to run the model. */ hardware?: string; /** * The maximum number of instances for scaling. */ max_instances?: number; /** * The minimum number of instances for scaling. */ min_instances?: number; } interface CreatedBy { /** * The account type of the creator. Can be a user or an organization. */ type: 'organization' | 'user'; /** * The username of the account that created the release. */ username: string; /** * The avatar URL for the account that created the release. */ avatar_url?: string; /** * The GitHub URL of the account that created the release. */ github_url?: string; /** * The name of the account that created the release. */ name?: string; } } } export interface DeploymentUpdateResponse { current_release?: DeploymentUpdateResponse.CurrentRelease; /** * The name of the deployment. */ name?: string; /** * The owner of the deployment. */ owner?: string; } export declare namespace DeploymentUpdateResponse { interface CurrentRelease { configuration?: CurrentRelease.Configuration; /** * The time the release was created. */ created_at?: string; created_by?: CurrentRelease.CreatedBy; /** * The model identifier string in the format of `{model_owner}/{model_name}`. */ model?: string; /** * The release number. */ number?: number; /** * The ID of the model version used in the release. */ version?: string; } namespace CurrentRelease { interface Configuration { /** * The SKU for the hardware used to run the model. */ hardware?: string; /** * The maximum number of instances for scaling. */ max_instances?: number; /** * The minimum number of instances for scaling. */ min_instances?: number; } interface CreatedBy { /** * The account type of the creator. Can be a user or an organization. */ type: 'organization' | 'user'; /** * The username of the account that created the release. */ username: string; /** * The avatar URL for the account that created the release. */ avatar_url?: string; /** * The GitHub URL of the account that created the release. */ github_url?: string; /** * The name of the account that created the release. */ name?: string; } } } export interface DeploymentListResponse { current_release?: DeploymentListResponse.CurrentRelease; /** * The name of the deployment. */ name?: string; /** * The owner of the deployment. */ owner?: string; } export declare namespace DeploymentListResponse { interface CurrentRelease { configuration?: CurrentRelease.Configuration; /** * The time the release was created. */ created_at?: string; created_by?: CurrentRelease.CreatedBy; /** * The model identifier string in the format of `{model_owner}/{model_name}`. */ model?: string; /** * The release number. */ number?: number; /** * The ID of the model version used in the release. */ version?: string; } namespace CurrentRelease { interface Configuration { /** * The SKU for the hardware used to run the model. */ hardware?: string; /** * The maximum number of instances for scaling. */ max_instances?: number; /** * The minimum number of instances for scaling. */ min_instances?: number; } interface CreatedBy { /** * The account type of the creator. Can be a user or an organization. */ type: 'organization' | 'user'; /** * The username of the account that created the release. */ username: string; /** * The avatar URL for the account that created the release. */ avatar_url?: string; /** * The GitHub URL of the account that created the release. */ github_url?: string; /** * The name of the account that created the release. */ name?: string; } } } export interface DeploymentGetResponse { current_release?: DeploymentGetResponse.CurrentRelease; /** * The name of the deployment. */ name?: string; /** * The owner of the deployment. */ owner?: string; } export declare namespace DeploymentGetResponse { interface CurrentRelease { configuration?: CurrentRelease.Configuration; /** * The time the release was created. */ created_at?: string; created_by?: CurrentRelease.CreatedBy; /** * The model identifier string in the format of `{model_owner}/{model_name}`. */ model?: string; /** * The release number. */ number?: number; /** * The ID of the model version used in the release. */ version?: string; } namespace CurrentRelease { interface Configuration { /** * The SKU for the hardware used to run the model. */ hardware?: string; /** * The maximum number of instances for scaling. */ max_instances?: number; /** * The minimum number of instances for scaling. */ min_instances?: number; } interface CreatedBy { /** * The account type of the creator. Can be a user or an organization. */ type: 'organization' | 'user'; /** * The username of the account that created the release. */ username: string; /** * The avatar URL for the account that created the release. */ avatar_url?: string; /** * The GitHub URL of the account that created the release. */ github_url?: string; /** * The name of the account that created the release. */ name?: string; } } } export interface DeploymentCreateParams { /** * The SKU for the hardware used to run the model. Possible values can be retrieved * from the `hardware.list` endpoint. */ hardware: string; /** * The maximum number of instances for scaling. */ max_instances: number; /** * The minimum number of instances for scaling. */ min_instances: number; /** * The full name of the model that you want to deploy e.g. stability-ai/sdxl. */ model: string; /** * The name of the deployment. */ name: string; /** * The 64-character string ID of the model version that you want to deploy. */ version: string; } export interface DeploymentUpdateParams { /** * Path param: The name of the user or organization that owns the deployment. */ deployment_owner: string; /** * Path param: The name of the deployment. */ deployment_name: string; /** * Body param: The SKU for the hardware used to run the model. Possible values can * be retrieved from the `hardware.list` endpoint. */ hardware?: string; /** * Body param: The maximum number of instances for scaling. */ max_instances?: number; /** * Body param: The minimum number of instances for scaling. */ min_instances?: number; /** * Body param: The ID of the model version that you want to deploy */ version?: string; } export interface DeploymentDeleteParams { /** * The name of the user or organization that owns the deployment. */ deployment_owner: string; /** * The name of the deployment. */ deployment_name: string; } export interface DeploymentGetParams { /** * The name of the user or organization that owns the deployment. */ deployment_owner: string; /** * The name of the deployment. */ deployment_name: string; } export declare namespace Deployments { export { type DeploymentCreateResponse as DeploymentCreateResponse, type DeploymentUpdateResponse as DeploymentUpdateResponse, type DeploymentListResponse as DeploymentListResponse, type DeploymentGetResponse as DeploymentGetResponse, type DeploymentListResponsesCursorURLPage as DeploymentListResponsesCursorURLPage, type DeploymentCreateParams as DeploymentCreateParams, type DeploymentUpdateParams as DeploymentUpdateParams, type DeploymentDeleteParams as DeploymentDeleteParams, type DeploymentGetParams as DeploymentGetParams, }; export { Predictions as Predictions, type PredictionCreateParams as PredictionCreateParams }; } //# sourceMappingURL=deployments.d.ts.map