> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galtea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create model

> Create a new model. See [Models](https://docs.galtea.ai/concepts/model).

> [!WARNING]
>
> You are reading the docs of Galtea 5.16. [Read this page in the latest version](https://docs.galtea.ai/api-reference/models/create-model.md).


## OpenAPI

````yaml /v5.16/openapi.json post /models
openapi: 3.0.0
info:
  version: 1.0.0
  title: Product Management Service API
  description: API documentation for Product Management Service
  contact:
    name: Galtea AI
servers:
  - url: https://api.galtea.ai
security:
  - bearerAuth: []
tags: []
externalDocs:
  description: Galtea Platform Documentation
  url: https://docs.galtea.ai
paths:
  /models:
    post:
      tags:
        - models
      summary: Create model
      description: Create a new model. See [Models](https://docs.galtea.ai/concepts/model).
      operationId: createModel
      parameters:
        - $ref: '#/components/parameters/Prefer'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModelWrite'
      responses:
        '201':
          description: >-
            Model created successfully. On `Prefer: return=minimal`, or when the
            read after the write fails, the answer has no body.
          headers:
            Location:
              schema:
                type: string
                description: The path of the new resource
              required: true
              description: The path of the new resource
            Content-Location:
              schema:
                type: string
                description: >-
                  The path of the resource in the body; absent when there is no
                  body
              required: false
              description: >-
                The path of the resource in the body; absent when there is no
                body
            Preference-Applied:
              schema:
                type: string
                enum:
                  - return=minimal
                description: 'Present when the API honored `Prefer: return=minimal`'
              required: false
              description: 'Present when the API honored `Prefer: return=minimal`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Model'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The role or user groups of the caller do not allow model.create, or
            organizationId names another organization or a global model
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No organization has the id that organizationId names
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  parameters:
    Prefer:
      schema:
        $ref: '#/components/schemas/Prefer'
      required: false
      description: >-
        Send `return=minimal` to get no body back from a write and skip reading
        the resource: a create answers `201` with only `Location`, and an update
        answers `204`.
      name: Prefer
      in: header
  schemas:
    ModelWrite:
      type: object
      properties:
        id:
          type: string
          nullable: true
          description: 'Read-only: the server sets it, and a value sent here is ignored.'
        userId:
          type: string
          nullable: true
          description: 'Read-only: the server sets it, and a value sent here is ignored.'
        createdAt:
          type: string
          nullable: true
          format: date-time
          description: 'Read-only: the server sets it, and a value sent here is ignored.'
        deletedAt:
          type: string
          nullable: true
          format: date-time
          description: 'Read-only: the server sets it, and a value sent here is ignored.'
        name:
          type: string
          example: GPT-4
        organizationId:
          type: string
          nullable: true
          example: org_123
          description: >-
            The organization that owns the model. null makes it global, which
            only a platform admin may do.
        inputCostPerToken:
          type: number
          nullable: true
          example: 0.00001
        outputCostPerToken:
          type: number
          nullable: true
          example: 0.00003
        cacheReadInputTokenCost:
          type: number
          nullable: true
          example: 0.000005
        cacheCreationInputTokenCost:
          type: number
          nullable: true
          example: 0.000015
        inputCostPerTokenAbove128kTokens:
          type: number
          nullable: true
          example: 0.00002
        outputCostPerTokenAbove128kTokens:
          type: number
          nullable: true
          example: 0.00006
        tokenizerProvider:
          type: string
          nullable: true
          example: OPENAI
        source:
          type: string
          nullable: true
          enum:
            - PREDEFINED
            - CUSTOM
          example: CUSTOM
    Model:
      type: object
      properties:
        id:
          type: string
          example: model_123
        organizationId:
          type: string
          nullable: true
          example: org_123
        userId:
          type: string
          nullable: true
          example: user_123
        name:
          type: string
          example: GPT-4
        inputCostPerToken:
          type: number
          nullable: true
          example: 0.00001
        outputCostPerToken:
          type: number
          nullable: true
          example: 0.00003
        cacheReadInputTokenCost:
          type: number
          nullable: true
          example: 0.000005
        cacheCreationInputTokenCost:
          type: number
          nullable: true
          example: 0.000015
        inputCostPerTokenAbove128kTokens:
          type: number
          nullable: true
          example: 0.00002
        outputCostPerTokenAbove128kTokens:
          type: number
          nullable: true
          example: 0.00006
        tokenizerProvider:
          type: string
          nullable: true
          example: OPENAI
        source:
          type: string
          nullable: true
          enum:
            - PREDEFINED
            - CUSTOM
          example: PREDEFINED
        createdAt:
          type: string
          format: date-time
        deletedAt:
          type: string
          format: date-time
          nullable: true
      required:
        - id
        - organizationId
        - userId
        - name
        - inputCostPerToken
        - outputCostPerToken
        - cacheReadInputTokenCost
        - cacheCreationInputTokenCost
        - inputCostPerTokenAbove128kTokens
        - outputCostPerTokenAbove128kTokens
        - tokenizerProvider
        - source
        - createdAt
        - deletedAt
    Error:
      type: object
      properties:
        error:
          type: string
          example: Error type
        message:
          type: string
          example: Error message description
    Prefer:
      type: string
      description: >-
        Send `return=minimal` to get no body back from a write and skip reading
        the resource: a create answers `201` with only `Location`, and an update
        answers `204`.
      example: return=minimal
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authorization. Pass your API key in the Authorization header as
        a Bearer token. Both new (`gsk_*`) and legacy (`gsk-`) API keys are
        accepted, e.g. `Authorization: Bearer gsk_...` or `Authorization: Bearer
        gsk-...`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.