Replicate Models API

The Models API from Replicate — 1 operation(s) for models.

OpenAPI Specification

replicate-models-api-openapi.yml Raw ↑
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 Models API
  version: 1.0.0-a1
servers:
- url: https://api.replicate.com/v1
security:
- bearerAuth: []
tags:
- name: Models
paths:
  /models:
    query:
      description: "Get a list of public models matching a search query.\n\nExample cURL request:\n\n```console\ncurl -s -X QUERY \\\n  -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n  -H \"Content-Type: text/plain\" \\\n  -d \"hello\" \\\n  https://api.replicate.com/v1/models\n```\n\nThe response will be a paginated JSON object containing an array of model objects:\n\n```json\n{\n  \"next\": null,\n  \"previous\": null,\n  \"results\": [\n    {\n      \"url\": \"https://replicate.com/acme/hello-world\",\n      \"owner\": \"acme\",\n      \"name\": \"hello-world\",\n      \"description\": \"A tiny model that says hello\",\n      \"visibility\": \"public\",\n      \"github_url\": \"https://github.com/replicate/cog-examples\",\n      \"paper_url\": null,\n      \"license_url\": null,\n      \"run_count\": 5681081,\n      \"cover_image_url\": \"...\",\n      \"default_example\": {...},\n      \"latest_version\": {...}\n    }\n  ]\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n"
      operationId: models.search
      requestBody:
        content:
          text/plain:
            schema:
              description: The search query
              type: string
        required: true
      responses:
        '200':
          description: Success
      summary: Search Public Models
      tags: []
    get:
      description: "Get a paginated list of public models.\n\nExample cURL request:\n\n```console\ncurl -s \\\n  -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n  https://api.replicate.com/v1/models\n```\n\nThe response will be a paginated JSON array of model objects:\n\n```json\n{\n  \"next\": null,\n  \"previous\": null,\n  \"results\": [\n    {\n      \"url\": \"https://replicate.com/acme/hello-world\",\n      \"owner\": \"acme\",\n      \"name\": \"hello-world\",\n      \"description\": \"A tiny model that says hello\",\n      \"visibility\": \"public\",\n      \"github_url\": \"https://github.com/replicate/cog-examples\",\n      \"paper_url\": null,\n      \"license_url\": null,\n      \"run_count\": 5681081,\n      \"cover_image_url\": \"...\",\n      \"default_example\": {...},\n      \"latest_version\": {...}\n    }\n  ]\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n"
      operationId: models.list
      responses:
        '200':
          description: Success
      summary: List Public Models
      tags:
      - Models
    post:
      description: "Create a model.\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n  -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"owner\": \"alice\", \"name\": \"my-model\", \"description\": \"An example model\", \"visibility\": \"public\", \"hardware\": \"cpu\"}' \\\n  https://api.replicate.com/v1/models\n```\n\nThe response will be a model object in the following format:\n\n```json\n{\n  \"url\": \"https://replicate.com/alice/my-model\",\n  \"owner\": \"alice\",\n  \"name\": \"my-model\",\n  \"description\": \"An example model\",\n  \"visibility\": \"public\",\n  \"github_url\": null,\n  \"paper_url\": null,\n  \"license_url\": null,\n  \"run_count\": 0,\n  \"cover_image_url\": null,\n  \"default_example\": null,\n  \"latest_version\": null,\n}\n```\n\nNote that there is a limit of 1,000 models per account. For most purposes, we recommend using a single model and pushing new [versions](https://replicate.com/docs/how-does-replicate-work#versions) of the model as you make changes to it.\n"
      operationId: models.create
      requestBody:
        content:
          application/json:
            schema:
              properties:
                cover_image_url:
                  description: A URL for the model's cover image. This should be an image file.
                  type: string
                description:
                  description: A description of the model.
                  type: string
                github_url:
                  description: A URL for the model's source code on GitHub.
                  type: string
                hardware:
                  description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint.
                  type: string
                license_url:
                  description: A URL for the model's license.
                  type: string
                name:
                  description: The name of the model. This must be unique among all models owned by the user or organization.
                  type: string
                owner:
                  description: The name of the user or organization that will own the model. This must be the same as the user or organization that is making the API request. In other words, the API token used in the request must belong to this user or organization.
                  type: string
                paper_url:
                  description: A URL for the model's paper.
                  type: string
                visibility:
                  description: Whether the model should be public or private. A public model can be viewed and run by anyone, whereas a private model can be viewed and run only by the user or organization members that own the model.
                  enum:
                  - public
                  - private
                  type: string
              required:
              - owner
              - name
              - visibility
              - hardware
              type: object
        required: true
      responses:
        '201':
          description: Success
      summary: Create a Model
      tags:
      - Models
components:
  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