Exoscale model API

Lifecycle of AI Models.

OpenAPI Specification

exoscale-model-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: 2.0.0
  termsOfService: https://exoscale.com/terms
  contact:
    email: support@exoscale.com
    name: Exoscale Support
    url: https://portal.exoscale.com/tickets
  title: Exoscale ai-api-key model API
  description: Infrastructure automation API, allowing programmatic access to all Exoscale products and services.
servers:
- url: https://api-{zone}.exoscale.com/v2
  variables:
    zone:
      default: ch-gva-2
      enum:
      - ch-gva-2
      - ch-dk-2
      - de-fra-1
      - de-muc-1
      - at-vie-1
      - at-vie-2
      - bg-sof-1
      - hr-zag-1
tags:
- description: Lifecycle of AI Models.
  parent: ai
  externalDocs:
    description: Read more
    url: https://www.exoscale.com/ai-cloud-infrastructure/dedicated-inference/
  name: model
  x-display-name: AI Model
  x-weight: 920
  x-icon: exo-ai-prod
paths:
  /ai/model:
    post:
      tags:
      - model
      responses:
        '403':
          description: '403'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/forbidden-operation-response'
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/operation'
      description: 'Model files will be downloaded from Huggingface.


        Name must be the exact name of the model on huggingface (ex: openai/gpt-oss-120b or ggml-org/gpt-oss-120b-GGUF).


        If the model is under a license then you must provide a Huggingface access token for an account that signed the license agreement'
      parameters: []
      summary: Create Model
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create-model-request'
      operationId: create-model
    get:
      tags:
      - model
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list-models-response'
      description: List Models
      parameters:
      - in: query
        required: false
        name: visibility
        schema:
          type: string
      summary: List Models
      operationId: list-models
  /ai/model/{id}:
    delete:
      tags:
      - model
      responses:
        '412':
          description: '412'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/delete-model-conflict-response'
        '403':
          description: '403'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/forbidden-operation-response'
        '404':
          description: '404'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error-response'
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/operation'
      description: Delete Model
      parameters:
      - in: path
        required: true
        name: id
        schema:
          type: string
          format: uuid
      summary: Delete Model
      operationId: delete-model
    get:
      tags:
      - model
      responses:
        '404':
          description: '404'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error-response'
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-model-response'
      description: Get Model details
      parameters:
      - in: path
        required: true
        name: id
        schema:
          type: string
          format: uuid
      summary: Get Model
      operationId: get-model
components:
  schemas:
    list-models-response-entry:
      description: AI model
      properties:
        updated-at:
          description: Update time
          format: date-time
          type: string
          readOnly: true
        name:
          description: Model name
          type: string
          minLength: 1
        state:
          description: Model state
          enum:
          - ready
          - creating
          - downloading
          - error
          - created
          type: string
        id:
          description: Model ID
          format: uuid
          type: string
          readOnly: true
        model-size:
          description: Model size (nullable)
          format: int64
          type: integer
          minimum: 0
        created-at:
          description: Creation time
          format: date-time
          type: string
          readOnly: true
      type: object
    error-response:
      type: object
      description: RFC 9457 Problem Details error response
      required:
      - type
      - title
      - status
      - detail
      properties:
        type:
          type: string
          format: uri-reference
        title:
          type: string
        status:
          type: integer
          minimum: 100
          maximum: 599
        detail:
          type: string
        instance:
          type: string
          format: uri-reference
        errors:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              detail:
                type: string
              pointer:
                type: string
              location:
                type: string
    create-model-request:
      description: AI model
      properties:
        name:
          description: Model name
          type: string
          minLength: 1
        huggingface-token:
          description: Huggingface Token
          type: string
      type: object
      required:
      - name
    forbidden-operation-response:
      description: Forbidden operation response
      properties:
        code:
          description: Machine-readable forbidden error code
          enum:
          - forbidden_operation
          type: string
          readOnly: true
        error:
          description: Forbidden error message
          type: string
          readOnly: true
      type: object
      required:
      - error
      - code
    list-models-response:
      description: AI model list
      properties:
        models:
          type: array
          items:
            $ref: '#/components/schemas/list-models-response-entry'
      type: object
    get-model-response:
      description: AI model
      properties:
        updated-at:
          description: Update time
          format: date-time
          type: string
          readOnly: true
        name:
          description: Model name
          type: string
          minLength: 1
        state:
          description: Model state
          enum:
          - ready
          - creating
          - downloading
          - error
          - created
          type: string
        id:
          description: Model ID
          format: uuid
          type: string
          readOnly: true
        model-size:
          description: Model size (nullable)
          format: int64
          type: integer
          minimum: 0
        created-at:
          description: Creation time
          format: date-time
          type: string
          readOnly: true
      type: object
    delete-model-conflict-response:
      description: 'Model is in use: deletion forbidden'
      properties:
        deployments:
          description: Deployments using models
          type: array
          items:
            type: string
      type: object
    operation:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          description: Operation ID
        reason:
          type: string
          enum:
          - incorrect
          - unknown
          - unavailable
          - forbidden
          - busy
          - fault
          - partial
          - not-found
          - interrupted
          - unsupported
          - conflict
          readOnly: true
          description: Operation failure reason
        reference:
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: Reference ID
            link:
              type: string
              readOnly: true
              description: Link to the referenced resource
            command:
              type: string
              description: Command name
          description: Related resource reference
          readOnly: true
        message:
          type: string
          readOnly: true
          description: Operation message
        state:
          type: string
          enum:
          - failure
          - pending
          - success
          - timeout
          readOnly: true
          description: Operation status
      description: Operation
x-topics:
- title: API Request Signature
  content: '

    In order to authenticate legitimate users, the Exoscale API requires incoming requests to be signed using valid Exoscale API account credentials with the following mechanism.


    ## Signature Mechanism


    The *message* (i.e. content) to sign contains several segments concatenated using a line return character (`\n`).


    All segments must be included and in the described order. For cases where a segment doesn''t fit the context of the request (e.g. no request body) **an empty line must be used instead**.


    * Request method and request URL (path only), separated by a space character

    * Request body

    * Request URL parameters (Query String) values, concatenated without separator. The matching parameter names have to be specified in the resulting signature header `signed-query-args=` pragma, separated by semicolons (e.g. `p1;p2;pN`).

    * Request header values, concatenated without separator (none at the moment, leave empty)

    * Request expiration date in UNIX timestamp format


    Example *message* to sign for `GET /v2/resource/a02baf5a-a3e4-49a0-857b-8a08d276c1c0?p1=v1&p2=v2`:


    ```

    GET /v2/resource/a02baf5a-a3e4-49a0-857b-8a08d276c1c0


    v1v2


    1599140767

    ```


    The two blank lines above are due to the absence of a request body and signed headers.


    Example *message* to [create a security group](https://community.exoscale.com/reference/api/compute/security-group/#create-security-group)


    ```

    POST /v2/security-group

    {"name": "my-security-group"}



    1599140767

    ```


    The two blank lines above are due to the absence of query parameters and signed headers.


    The request signature consists of the base64-encoded [HMAC](https://en.wikipedia.org/wiki/HMAC) hash of the UTF-8 encoded *message* and the Exoscale API secret using the SHA265 function:


    ```

    signature = BASE64_ENCODE(HMAC_SHA256(Exoscale API secret, message))

    ```


    Finally, the computed signature must be added to the API request in a `Authorization` header such as:


    ```

    Authorization: EXO2-HMAC-SHA256 credential=<Exoscale API key>,expires=<expiration date UNIX timestamp>,signature=<signature>

    ```


    Example API query:


    ```

    GET /v2/resource/a02baf5a-a3e4-49a0-857b-8a08d276c1c0?p1=v1&p2=v2 HTTP/1.1

    Host: api-ch-gva-2.exoscale.com

    Authorization: EXO2-HMAC-SHA256 credential=EXO29147e9f89102b7ac1e88514,signed-query-args=p1;p2,expires=1599140767,signature=2AOBQsbElQb4FpKT/FM/9T4NobjlmZkSGvvdUth/xlY=

    ```


    ## Reference Implementations


    You can look up the following existing reference implementations:


    * Go: [github.com/exoscale/egoscale/api/v2 > `SecurityProviderExoscale.signRequest`](https://github.com/exoscale/egoscale/blob/master/v2/api/security.go)

    * Python: [requests-exoscale-auth > `ExoscaleV2Auth`](https://github.com/exoscale/requests-exoscale-auth/blob/master/exoscale_auth.py)


    '
- title: Zone local resources
  content: '

    The API is deployed across all Exoscale zones. When performing a compute call, you should use the relevant zone for your resource.

    For example: https://api-de-fra-1.exoscale.com/v2/instance would return only the instances from `de-fra-1`, https://api-ch-gva-2.exoscale.com/v2/instance from `ch-gva-2`.

    To obtain a list of all instances across all zones, you would need to do the corresponding request for each zone.

    '