> ## 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.

# Update model

> Update an existing model. See [Models](https://docs.galtea.ai/concepts/model).

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


## OpenAPI

````yaml /v5.17/openapi.json patch /models/{id}
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/{id}:
    patch:
      tags:
        - models
      summary: Update model
      description: >-
        Update an existing model. See
        [Models](https://docs.galtea.ai/concepts/model).
      operationId: updateModel
      parameters:
        - schema:
            type: string
            description: Model ID
          required: true
          description: Model ID
          name: id
          in: path
        - $ref: '#/components/parameters/Prefer'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModelWrite'
      responses:
        '200':
          description: >-
            Model updated successfully. The body is the resource as its GET
            answers it.
          headers:
            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'
        '204':
          description: >-
            No body: the client sent `Prefer: return=minimal`, or the read after
            the write failed.
          headers:
            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`'
        '400':
          description: Invalid request body, an empty name, or a blank organizationId
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The caller may not update the model, or may not update it in the
            organization that organizationId names (null makes it global).
            Checked before the write.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            Model not found, or 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.