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

# Extend model resources expiry

> Keeps a ready model resource from stopping for inactivity for at least the given number of seconds from now. It moves the resource's `expires_at` to at least that time, and never earlier. Every operation on the resource's sessions already keeps it up for `inactive_timeout` seconds, so use this only to stay up longer without operations, for example while you compute rewards. Fails if the resource is not ready.



## OpenAPI

````yaml openapi.yaml POST /v1/rl/model-resources/{model_resources_id}/extend-expiry
openapi: 3.1.0
info:
  title: Together APIs
  description: The Together REST API. See https://docs.together.ai for more details.
  version: 2.0.0
  termsOfService: https://www.together.ai/terms-of-service
  contact:
    name: Together Support
    url: https://www.together.ai/contact
  license:
    name: MIT
    url: https://github.com/togethercomputer/openapi/blob/main/LICENSE
servers:
  - url: https://api.together.ai
    description: Default environment for APIs
security:
  - bearerAuth: []
paths:
  /v1/rl/model-resources/{model_resources_id}/extend-expiry:
    post:
      tags:
        - RL
      summary: Extend model resources expiry
      description: >-
        Keeps a ready model resource from stopping for inactivity for at least
        the given number of seconds from now. It moves the resource's
        `expires_at` to at least that time, and never earlier. Every operation
        on the resource's sessions already keeps it up for `inactive_timeout`
        seconds, so use this only to stay up longer without operations, for
        example while you compute rewards. Fails if the resource is not ready.
      operationId: extendModelResourcesExpiry
      parameters:
        - name: model_resources_id
          in: path
          required: true
          schema:
            description: ID of the model resource
            type: string
            default: false
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RL.ExtendModelResourcesExpiryRequest'
      responses:
        '200':
          description: Model resource details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RL.ModelResources'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
      x-codeSamples:
        - lang: Python
          label: Together AI SDK (Python)
          source: |
            from together import Together

            client = Together()

            resource = client.post_training.model_resources.extend_expiry(
                "<MODEL_RESOURCES_ID>",
                seconds=7200,
            )
            print(resource.status, resource.expires_at)
components:
  schemas:
    RL.ExtendModelResourcesExpiryRequest:
      type: object
      description: Request to keep a model resource from stopping for inactivity
      required:
        - seconds
      properties:
        seconds:
          type: integer
          minimum: 60
          maximum: 86400
          example: 7200
          description: Seconds from now the resource must not stop for inactivity.
    RL.ModelResources:
      type: object
      description: Allocated GPU resources that training sessions attach to
      required:
        - id
        - status
        - status_details
        - base_model
        - compute_config
        - lora_enabled
        - created_at
        - updated_at
        - optimizer_config
        - created_by
        - inactive_timeout
      properties:
        id:
          type: string
          example: 123e4567-e89b-12d3-a456-426614174000
          description: Unique identifier for the model resource
        status:
          $ref: '#/components/schemas/RL.ModelResourcesStatus'
          example: MODEL_RESOURCES_STATUS_READY
          description: Lifecycle status of the model resource
        error:
          $ref: '#/components/schemas/RL.ModelResourcesError'
          description: >-
            Structured detail for the model resource's current error. Set when
            the resource is in an error state.
        status_details:
          $ref: '#/components/schemas/RL.ModelResourcesStatusDetails'
          description: >-
            Details of the resource's current status, such as its place in the
            queue.
        base_model:
          type: string
          example: Qwen/Qwen3.5-4B
          description: Base model the resource is provisioned for
        base_weights_ref:
          type: string
          example: together://ml_A1b2C3d4E5f6G7h8I9j0K@rv_A1b2C3d4E5f6G7h8I9j0K
          description: >-
            Model-registry model whose weights the resource trains in place of
            the base model's own, pinned to the revision resolved when the
            resource was created. Absent when the resource trains the base
            model's own weights.
        compute_config:
          $ref: '#/components/schemas/RL.ComputeConfig'
          description: Compute layout provisioned for the resource.
        lora_enabled:
          type: boolean
          example: true
          description: Whether the resource hosts LoRA sessions or a full-weight session
        created_at:
          type: string
          format: date-time
          example: '2026-01-02T00:00:00Z'
          description: Timestamp when the model resource was created
        updated_at:
          type: string
          format: date-time
          example: '2026-01-02T00:00:05Z'
          description: Timestamp when the model resource was last updated
        optimizer_config:
          $ref: '#/components/schemas/RL.OptimizerConfig'
          description: Optimizer configuration for this resource.
        created_by:
          type: string
          example: user_123
          description: ID of the user who created the model resource
        inactive_timeout:
          type: integer
          example: 3600
          description: >-
            Seconds without activity after which the resource stops and its
            sessions expire. Every operation on any of its sessions restarts the
            count.
        expires_at:
          type: string
          format: date-time
          example: '2026-01-02T01:00:05Z'
          description: >-
            The earliest time the resource can stop for inactivity, which also
            expires its sessions. It is the resource's last activity plus
            `inactive_timeout` seconds. Becoming ready, a session start and
            every operation on any of its sessions count as activity, and the
            resource does not stop while an operation is running. An extend
            expiry call can move it later. It never moves earlier. Refreshed
            about once a minute. Set while the resource is ready.
    ErrorData:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              nullable: false
            type:
              type: string
              nullable: false
            param:
              type: string
              nullable: true
              default: null
            code:
              type: string
              nullable: true
              default: null
          required:
            - type
            - message
    RL.ModelResourcesStatus:
      description: Lifecycle status of a model resource
      type: string
      enum:
        - MODEL_RESOURCES_STATUS_PENDING
        - MODEL_RESOURCES_STATUS_CREATING
        - MODEL_RESOURCES_STATUS_READY
        - MODEL_RESOURCES_STATUS_ERROR
        - MODEL_RESOURCES_STATUS_STOPPED
        - MODEL_RESOURCES_STATUS_STOPPING
    RL.ModelResourcesError:
      type: object
      description: Structured detail for the model resource's current error
      required:
        - code
        - message
        - occurred_at
      properties:
        code:
          $ref: '#/components/schemas/RL.ModelResourcesErrorCode'
          example: MODEL_RESOURCES_ERROR_CODE_CAPACITY_WAIT_TIMEOUT
          description: Finite machine-readable reason code for UI branching
        message:
          type: string
          example: Timed out waiting for cluster capacity. Try again later.
          description: User-safe human-readable detail for the current status
        occurred_at:
          type: string
          format: date-time
          example: '2026-01-02T00:00:05Z'
          description: Timestamp when this error was reported
    RL.ModelResourcesStatusDetails:
      type: object
      description: Details of a model resource's current status
      properties:
        queue_position:
          type: integer
          format: int64
          example: 3
          description: >-
            Estimated place of the resource in the queue: the number of older
            resources of the same GPU type still waiting for GPUs, plus one. Set
            only while the resource waits for GPUs.
    RL.ComputeConfig:
      type: object
      description: Compute layout for a model resource
      required:
        - num_generator_replicas
      properties:
        num_generator_replicas:
          type: integer
          format: int32
          example: 1
          description: >-
            Number of generator replicas. 0 means the resource runs the trainer
            only, with no generator.
        gpu_type:
          type: string
          example: B200-SXM
          enum:
            - H100-80GB
            - B200-SXM
          description: GPU type selected for this resource.
    RL.OptimizerConfig:
      type: object
      description: Optimizer configuration
      properties:
        adam:
          $ref: '#/components/schemas/RL.AdamConfig'
          description: Use the Adam optimizer.
        muon:
          $ref: '#/components/schemas/RL.MuonConfig'
          description: Use the Muon optimizer.
    RL.ModelResourcesErrorCode:
      type: string
      description: Finite machine-readable model resource lifecycle error code
      enum:
        - MODEL_RESOURCES_ERROR_CODE_CAPACITY_WAIT_TIMEOUT
        - MODEL_RESOURCES_ERROR_CODE_PROVISIONING_FAILED
        - MODEL_RESOURCES_ERROR_CODE_RESOURCE_UNAVAILABLE
    RL.AdamConfig:
      type: object
      description: Adam optimizer configuration
      properties: {}
      additionalProperties: false
      x-stainless-empty-object: true
    RL.MuonConfig:
      type: object
      description: Advanced configuration for the Muon optimizer.
      properties:
        scaling_strategy:
          $ref: '#/components/schemas/RL.MuonScalingStrategy'
          example: MUON_SCALING_STRATEGY_ORIGINAL
          default: MUON_SCALING_STRATEGY_MATCH_ADAM
          description: Scaling strategy for the Muon optimizer.
    RL.MuonScalingStrategy:
      type: string
      enum:
        - MUON_SCALING_STRATEGY_UNSPECIFIED
        - MUON_SCALING_STRATEGY_MATCH_ADAM
        - MUON_SCALING_STRATEGY_ORIGINAL
      default: MUON_SCALING_STRATEGY_UNSPECIFIED
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-bearer-format: bearer
      x-default: default

````

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