openapi: 3.1.0 info: contact: email: team@replicate.com description: AI can do extraordinary things, but its still too hard to use. We don't believe AI is inherently hard. We just don't have the right tools and abstractions yet. Were building tools so all software engineers can use AI as if it were normal software. You should be able to import an image generator the same way you import an npm package. You should be able to customize a model as easily as you can fork something on GitHub. termsOfService: https://replicate.com/terms title: Replicate Accounts Deployments API version: 1.0.0-a1 servers: - url: https://api.replicate.com/v1 security: - bearerAuth: [] tags: - name: Deployments paths: /deployments: get: description: "Get a list of deployments associated with the current account, including the latest release configuration for each deployment.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/deployments\n```\n\nThe response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:\n\n```json\n{\n \"next\": \"http://api.replicate.com/v1/deployments?cursor=cD0yMDIzLTA2LTA2KzIzJTNBNDAlM0EwOC45NjMwMDAlMkIwMCUzQTAw\",\n \"previous\": null,\n \"results\": [\n {\n \"owner\": \"replicate\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n }\n ]\n}\n```\n" operationId: deployments.list responses: '200': content: application/json: schema: properties: next: description: A URL pointing to the next page of deployment objects if any nullable: true type: string previous: description: A URL pointing to the previous page of deployment objects if any nullable: true type: string results: description: An array containing a page of deployment objects items: properties: current_release: properties: configuration: properties: hardware: description: The SKU for the hardware used to run the model. type: string max_instances: description: The maximum number of instances for scaling. type: integer min_instances: description: The minimum number of instances for scaling. type: integer type: object created_at: description: The time the release was created. format: date-time type: string created_by: properties: github_url: description: The GitHub URL of the account that created the release. format: uri type: string name: description: The name of the account that created the release. type: string type: description: The account type of the creator. Can be a user or an organization. enum: - organization - user type: string username: description: The username of the account that created the release. type: string type: object model: description: The model identifier string in the format of `{model_owner}/{model_name}`. type: string number: description: The release number. This is an auto-incrementing integer that starts at 1, and is set automatically when a deployment is created. type: integer version: description: The ID of the model version used in the release. type: string type: object name: description: The name of the deployment. type: string owner: description: The owner of the deployment. type: string type: object type: array type: object description: Success summary: List Deployments tags: - Deployments post: description: "Create a new deployment:\n\nExample cURL request:\n\n```console\ncurl -s \\\n -X POST \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-app-image-generator\",\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 0,\n \"max_instances\": 3\n }' \\\n https://api.replicate.com/v1/deployments\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n}\n```\n" operationId: deployments.create requestBody: content: application/json: schema: properties: hardware: description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. type: string max_instances: description: The maximum number of instances for scaling. maximum: 20 minimum: 0 type: integer min_instances: description: The minimum number of instances for scaling. maximum: 5 minimum: 0 type: integer model: description: The full name of the model that you want to deploy e.g. stability-ai/sdxl. type: string name: description: The name of the deployment. type: string version: description: The 64-character string ID of the model version that you want to deploy. type: string required: - name - model - version - hardware - min_instances - max_instances type: object required: true responses: '200': content: application/json: schema: properties: current_release: properties: configuration: properties: hardware: description: The SKU for the hardware used to run the model. type: string max_instances: description: The maximum number of instances for scaling. type: integer min_instances: description: The minimum number of instances for scaling. type: integer type: object created_at: description: The time the release was created. format: date-time type: string created_by: properties: github_url: description: The GitHub URL of the account that created the release. format: uri type: string name: description: The name of the account that created the release. type: string type: description: The account type of the creator. Can be a user or an organization. enum: - organization - user type: string username: description: The username of the account that created the release. type: string type: object model: description: The model identifier string in the format of `{model_owner}/{model_name}`. type: string number: description: The release number. type: integer version: description: The ID of the model version used in the release. type: string type: object name: description: The name of the deployment. type: string owner: description: The owner of the deployment. type: string type: object description: Success summary: Create a Deployment tags: - Deployments /deployments/{deployment_owner}/{deployment_name}: delete: description: "Delete a deployment\n\nDeployment deletion has some restrictions:\n\n- You can only delete deployments that have been offline and unused for at least 15 minutes.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n```\n\nThe response will be an empty 204, indicating the deployment has been deleted.\n" operationId: deployments.delete parameters: - description: 'The name of the user or organization that owns the deployment. ' in: path name: deployment_owner required: true schema: type: string - description: 'The name of the deployment. ' in: path name: deployment_name required: true schema: type: string responses: '204': description: Success summary: Delete a Deployment tags: - Deployments get: description: "Get information about a deployment by name including the current release.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/deployments/replicate/my-app-image-generator\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n}\n```\n" operationId: deployments.get parameters: - description: 'The name of the user or organization that owns the deployment. ' in: path name: deployment_owner required: true schema: type: string - description: 'The name of the deployment. ' in: path name: deployment_name required: true schema: type: string responses: '200': content: application/json: schema: properties: current_release: properties: configuration: properties: hardware: description: The SKU for the hardware used to run the model. type: string max_instances: description: The maximum number of instances for scaling. type: integer min_instances: description: The minimum number of instances for scaling. type: integer type: object created_at: description: The time the release was created. format: date-time type: string created_by: properties: github_url: description: The GitHub URL of the account that created the release. format: uri type: string name: description: The name of the account that created the release. type: string type: description: The account type of the creator. Can be a user or an organization. enum: - organization - user type: string username: description: The username of the account that created the release. type: string type: object model: description: The model identifier string in the format of `{model_owner}/{model_name}`. type: string number: description: The release number. type: integer version: description: The ID of the model version used in the release. type: string type: object name: description: The name of the deployment. type: string owner: description: The owner of the deployment. type: string type: object description: Success summary: Get a Deployment tags: - Deployments patch: description: "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).\n\nExample cURL request:\n\n```console\ncurl -s \\\n -X PATCH \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"min_instances\": 3, \"max_instances\": 10}' \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 2,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 3,\n \"max_instances\": 10\n }\n }\n}\n```\n\nUpdating any deployment properties will increment the `number` field of the `current_release`.\n" operationId: deployments.update parameters: - description: 'The name of the user or organization that owns the deployment. ' in: path name: deployment_owner required: true schema: type: string - description: 'The name of the deployment. ' in: path name: deployment_name required: true schema: type: string requestBody: content: application/json: schema: properties: hardware: description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. type: string max_instances: description: The maximum number of instances for scaling. maximum: 20 minimum: 0 type: integer min_instances: description: The minimum number of instances for scaling. maximum: 5 minimum: 0 type: integer version: description: The ID of the model version that you want to deploy type: string type: object responses: '200': content: application/json: schema: properties: current_release: properties: configuration: properties: hardware: description: The SKU for the hardware used to run the model. type: string max_instances: description: The maximum number of instances for scaling. type: integer min_instances: description: The minimum number of instances for scaling. type: integer type: object created_at: description: The time the release was created. format: date-time type: string created_by: properties: github_url: description: The GitHub URL of the account that created the release. format: uri type: string name: description: The name of the account that created the release. type: string type: description: The account type of the creator. Can be a user or an organization. enum: - organization - user type: string username: description: The username of the account that created the release. type: string type: object model: description: The model identifier string in the format of `{model_owner}/{model_name}`. type: string number: description: The release number. type: integer version: description: The ID of the model version used in the release. type: string type: object name: description: The name of the deployment. type: string owner: description: The owner of the deployment. type: string type: object description: Success summary: Update a Deployment tags: - Deployments /deployments/{deployment_owner}/{deployment_name}/predictions: post: description: "Create a prediction for the deployment and inputs you provide.\n\nExample cURL request:\n\n```console\ncurl -s -X POST -H 'Prefer: wait' \\\n -d '{\"input\": {\"prompt\": \"A photo of a bear riding a bicycle over the moon\"}}' \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions\n```\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `\"starting\"` state and need to be retrieved using the `predictions.get` endpiont.\n\nFor a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n" operationId: deployments.predictions.create parameters: - description: 'The name of the user or organization that owns the deployment. ' in: path name: deployment_owner required: true schema: type: string - description: 'The name of the deployment. ' in: path name: deployment_name required: true schema: type: string - $ref: '#/components/parameters/parameters_prefer_header' requestBody: content: application/json: schema: $ref: '#/components/schemas/schemas_prediction_request' responses: '201': description: 'Prediction has been created. If the `Prefer: wait` header is provided it will contain the final output.' '202': description: Prediction has been created but does not yet have all outputs summary: Create a Prediction Using a Deployment tags: - Deployments components: schemas: schemas_prediction_request: additionalProperties: false properties: input: description: 'The model''s input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input. Files should be passed as HTTP URLs or data URLs. Use an HTTP URL when: - you have a large file > 256kb - you want to be able to use the file multiple times - you want your prediction metadata to be associable with your input files Use a data URL when: - you have a small file <= 256kb - you don''t want to upload and host the file somewhere - you don''t need to use the file again (Replicate will not store it) ' type: object stream: description: '**This field is deprecated.** Request a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). This field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming. ' type: boolean webhook: description: 'An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting. ' type: string webhook_events_filter: description: "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:\n\n- `start`: immediately on prediction start\n- `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- `logs`: each time log output is generated by a prediction\n- `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n```json\n{\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n" items: enum: - start - output - logs - completed type: string type: array required: - input type: object parameters: parameters_prefer_header: description: 'Leave the request open and wait for the model to finish generating output. Set to `wait=n` where n is a number of seconds between 1 and 60. See https://replicate.com/docs/topics/predictions/create-a-prediction#sync-mode for more information.' in: header name: Prefer schema: example: wait=5 pattern: ^wait(=([1-9]|[1-9][0-9]|60))?$ type: string securitySchemes: bearerAuth: bearerFormat: 'All API requests must include a valid API token in the `Authorization` request header. The token must be prefixed by "Bearer", followed by a space and the token value. Example: `Authorization: Bearer r8_Hw***********************************` Find your tokens at https://replicate.com/account/api-tokens ' scheme: bearer type: http externalDocs: description: Replicate HTTP API url: https://replicate.com/docs/reference/http