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

# Optimizer step

> Submits an optimizer step operation that will asynchronously apply accumulated gradients to update model parameters. Does not make the updated parameters available for sampling; call `weights-sync` afterwards when you want subsequent samples to use the updated policy.



## OpenAPI

````yaml openapi.yaml POST /rl/training-sessions/{session_id}/operations/optim-step
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/v1
    description: Default environment for APIs
  - url: https://api-inference.together.ai/v2
    description: Optimized environment for inference
security:
  - bearerAuth: []
paths:
  /rl/training-sessions/{session_id}/operations/optim-step:
    post:
      tags:
        - RL
      summary: Optimizer step
      description: >-
        Submits an optimizer step operation that will asynchronously apply
        accumulated gradients to update model parameters. Does not make the
        updated parameters available for sampling; call `weights-sync`
        afterwards when you want subsequent samples to use the updated policy.
      operationId: OptimStep
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            description: Training session ID
            type: string
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            description: >-
              Required key that makes retries return the original operation; use
              a new key for changed request bodies.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RL.OptimStepBody'
        required: true
      responses:
        '200':
          description: Optimizer step operation details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RL.OptimStepOperation'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
components:
  schemas:
    RL.OptimStepBody:
      type: object
      description: Request body for an optimizer step.
      properties:
        adam_params:
          $ref: '#/components/schemas/RL.AdamParams'
          description: Adam optimizer overrides for this step.
        muon_params:
          $ref: '#/components/schemas/RL.MuonParams'
          description: Muon optimizer overrides for this step.
    RL.OptimStepOperation:
      type: object
      description: Async optimizer step operation
      required:
        - id
        - status
      properties:
        id:
          type: string
          example: 550e8400-e29b-41d4-a716-446655440000
          description: Operation ID
        status:
          $ref: '#/components/schemas/RL.TrainingOperationStatus'
          description: Operation status
        output:
          $ref: '#/components/schemas/RL.OptimStepResult'
          description: Result on success
        error:
          $ref: '#/components/schemas/RL.TrainingOperationError'
          description: Error details on failure
    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.AdamParams:
      description: Per-step Adam optimizer overrides.
      type: object
      properties:
        learning_rate:
          description: Learning rate for the Adam-tuned parameters
          type: number
          example: 0.0001
        beta1:
          description: Exponential decay rate for the first-moment estimate
          type: number
          example: 0.9
          default: 0.9
        beta2:
          description: Exponential decay rate for the second-moment estimate
          type: number
          example: 0.95
          default: 0.95
        eps:
          description: Epsilon for numerical stability
          type: number
          example: 1.e-8
          default: 1.e-8
        weight_decay:
          description: Weight decay coefficient
          type: number
          example: 0.1
          default: 0
        grad_clip_norm:
          description: >-
            Maximum gradient norm for this step, gradients across all model
            parameters are clipped to this value. Set to 0 to disable gradient
            clipping. When unset, gradients are clipped to the session default
            (1.0).
          type: number
          example: 10
          default: 1
    RL.MuonParams:
      type: object
      description: Per-step Muon optimizer overrides
      properties:
        learning_rate:
          type: number
          example: 0.02
          description: Learning rate for this Muon optimizer step.
        momentum:
          type: number
          example: 0.95
          default: 0.95
          description: Momentum coefficient
        newton_schulz_steps:
          type: integer
          example: 5
          default: 5
          description: Number of Newton-Schulz iterations
        weight_decay:
          type: number
          example: 0
          default: 0
          description: Weight decay coefficient
        grad_clip_norm:
          description: >-
            Maximum gradient norm for this step, gradients across all model
            parameters are clipped to this value. Set to 0 to disable gradient
            clipping. When unset, gradients are clipped to the session default
            (1.0).
          type: number
          example: 10
          default: 1
        adam:
          $ref: '#/components/schemas/RL.AdamParams'
          description: >-
            Per-step Adam optimizer overrides for the Adam-tuned parameters in a
            Muon-tuned optimizer session.
    RL.TrainingOperationStatus:
      type: string
      enum:
        - TRAINING_OPERATION_STATUS_UNSPECIFIED
        - TRAINING_OPERATION_STATUS_PENDING
        - TRAINING_OPERATION_STATUS_RUNNING
        - TRAINING_OPERATION_STATUS_COMPLETED
        - TRAINING_OPERATION_STATUS_FAILED
      default: TRAINING_OPERATION_STATUS_UNSPECIFIED
    RL.OptimStepResult:
      type: object
      description: Result of an optimizer step operation
      required:
        - step
      properties:
        step:
          description: Step number
          oneOf:
            - type: string
            - type: integer
          example: '100'
    RL.TrainingOperationError:
      type: object
      description: Error details for a failed training operation
      properties:
        code:
          $ref: '#/components/schemas/RL.TrainingOperationErrorCode'
          description: Application error code
          example: TRAINING_OPERATION_ERROR_CODE_TIMEOUT
        message:
          description: Human-readable error message
          type: string
          example: Operation timed out
    RL.TrainingOperationErrorCode:
      type: string
      description: Application error code for a failed training operation
      enum:
        - TRAINING_OPERATION_ERROR_CODE_UNSPECIFIED
        - TRAINING_OPERATION_ERROR_CODE_RESOURCE_EXHAUSTED
        - TRAINING_OPERATION_ERROR_CODE_TIMEOUT
        - TRAINING_OPERATION_ERROR_CODE_INTERNAL_ERROR
        - TRAINING_OPERATION_ERROR_CODE_SESSION_NOT_ACTIVE
        - TRAINING_OPERATION_ERROR_CODE_INVALID_INPUT
        - TRAINING_OPERATION_ERROR_CODE_NON_FINITE_LOSS
      default: TRAINING_OPERATION_ERROR_CODE_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.