# Create instance

> Create a new compute instance.
The optional mode field is retained for legacy compatibility. Its value does not select execution mode; routing is derived from num_gpus. New integrations should omit mode and use GET /v2/specs for available configurations.

SSH access: pass an SSH public key in the `public_key` field to seed the instance's `authorized_keys`. If omitted, Thunder generates a key pair and returns the private key in the response (it is only returned once — store it immediately).

Note: SSH keys saved in your account (Authentication section of the console) are a separate store and are NOT automatically attached to new instances. To use one of those keys, copy its public key material into the `public_key` field on this request.



## OpenAPI

````yaml ${THUNDER_API_BASE}/openapi.json post /instances/create
openapi: 3.1.0
info:
  contact:
    email: support@thundercompute.one
    name: Thunder Compute API Support
    url: https://www.thundercompute.one/contact
  description: >-
    Retrieve current GPU availability using mode-less spec keys

    Recommended for new integrations. The /status and /v1/status endpoints
    retain their legacy configuration keys for compatibility.
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  termsOfService: http://swagger.io/terms/
  title: Thunder Compute API
  version: '1.0'
servers:
  - description: Production server
    url: ${THUNDER_API_BASE}/v1
  - description: Production server
    url: ${THUNDER_API_BASE}
security: []
externalDocs:
  description: ''
  url: ''
paths:
  /instances/create:
    post:
      tags:
        - Instances
      summary: Create instance
      description: >-
        Create a new compute instance.

        The optional mode field is retained for legacy compatibility. Its value
        does not select execution mode; routing is derived from num_gpus. New
        integrations should omit mode and use GET /v2/specs for available
        configurations.


        SSH access: pass an SSH public key in the `public_key` field to seed the
        instance's `authorized_keys`. If omitted, Thunder generates a key pair
        and returns the private key in the response (it is only returned once —
        store it immediately).


        Note: SSH keys saved in your account (Authentication section of the
        console) are a separate store and are NOT automatically attached to new
        instances. To use one of those keys, copy its public key material into
        the `public_key` field on this request.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/thundertypes.InstanceCreateRequest'
              summary: request
              description: Instance creation parameters
        description: Instance creation parameters
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.InstanceCreateResponse'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Unauthorized
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.QuotaExceededResponse'
          description: The instance would exceed one of the organization's quotas
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: >-
            The organization's quotas could not be checked, or concurrent
            changes kept the request from committing; retry
      security:
        - ApiKeyAuth: []
components:
  schemas:
    thundertypes.InstanceCreateRequest:
      properties:
        cpu_cores:
          example: 4
          type: integer
        disk_size_gb:
          example: 100
          type: integer
        gpu_type:
          example: H100
          type: string
        mode:
          $ref: '#/components/schemas/thundertypes.InstanceMode'
          deprecated: true
          description: >-
            Deprecated: retained for legacy compatibility. Omit in new
            integrations. Behavior is specific to each endpoint; see its
            operation description.
        num_gpus:
          example: 1
          type: integer
        public_key:
          description: >-
            Optional SSH public key material to seed authorized_keys. If
            omitted, a key pair is generated and the private key returned.
          type: string
        template:
          example: ubuntu-22.04
          type: string
        workspace_id:
          type: string
      required:
        - cpu_cores
        - disk_size_gb
        - gpu_type
        - num_gpus
        - template
      type: object
    thundertypes.InstanceCreateResponse:
      properties:
        identifier:
          type: integer
        key:
          type: string
        uuid:
          type: string
        workspace_id:
          type: string
      required:
        - identifier
        - key
        - uuid
      type: object
    thundertypes.ErrorResponse:
      properties:
        code:
          example: 400
          type: integer
        error:
          example: invalid_request
          type: string
        message:
          example: The request is malformed
          type: string
      type: object
    thundertypes.QuotaExceededResponse:
      properties:
        code:
          example: 409
          type: integer
        error:
          example: quota_exceeded
          type: string
        message:
          type: string
        quota:
          $ref: '#/components/schemas/thundertypes.QuotaExceeded'
      type: object
    thundertypes.InstanceMode:
      enum:
        - prototyping
        - production
      type: string
      x-enum-varnames:
        - InstanceMode_Prototyping
        - InstanceMode_Production
    thundertypes.QuotaExceeded:
      properties:
        key:
          enum:
            - standard_gpus
            - premium_gpus
            - instances
            - sandboxes
            - sandbox_memory_gib
            - max_gpus_per_instance
          example: instances
          type: string
        limit:
          example: 10
          type: integer
        requested:
          example: 1
          type: integer
        usage:
          example: 10
          type: integer
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: >-
        Bearer token authentication. Provide your API token prefixed with
        "Bearer ", e.g. "Bearer your-api-token".
      in: header
      name: Authorization
      type: apiKey

````
