Optimizer step
curl --request POST \
--url https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"adam_params": {
"learning_rate": 0.0001,
"beta1": 0.9,
"beta2": 0.95,
"eps": 1e-8,
"weight_decay": 0.1,
"grad_clip_norm": 10
},
"muon_params": {
"learning_rate": 0.02,
"momentum": 0.95,
"newton_schulz_steps": 5,
"weight_decay": 0,
"grad_clip_norm": 10,
"adam": {
"learning_rate": 0.0001,
"beta1": 0.9,
"beta2": 0.95,
"eps": 1e-8,
"weight_decay": 0.1,
"grad_clip_norm": 10
}
}
}
'import requests
url = "https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step"
payload = {
"adam_params": {
"learning_rate": 0.0001,
"beta1": 0.9,
"beta2": 0.95,
"eps": 1e-8,
"weight_decay": 0.1,
"grad_clip_norm": 10
},
"muon_params": {
"learning_rate": 0.02,
"momentum": 0.95,
"newton_schulz_steps": 5,
"weight_decay": 0,
"grad_clip_norm": 10,
"adam": {
"learning_rate": 0.0001,
"beta1": 0.9,
"beta2": 0.95,
"eps": 1e-8,
"weight_decay": 0.1,
"grad_clip_norm": 10
}
}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
adam_params: {
learning_rate: 0.0001,
beta1: 0.9,
beta2: 0.95,
eps: 1e-8,
weight_decay: 0.1,
grad_clip_norm: 10
},
muon_params: {
learning_rate: 0.02,
momentum: 0.95,
newton_schulz_steps: 5,
weight_decay: 0,
grad_clip_norm: 10,
adam: {
learning_rate: 0.0001,
beta1: 0.9,
beta2: 0.95,
eps: 1e-8,
weight_decay: 0.1,
grad_clip_norm: 10
}
}
})
};
fetch('https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'adam_params' => [
'learning_rate' => 0.0001,
'beta1' => 0.9,
'beta2' => 0.95,
'eps' => 1e-8,
'weight_decay' => 0.1,
'grad_clip_norm' => 10
],
'muon_params' => [
'learning_rate' => 0.02,
'momentum' => 0.95,
'newton_schulz_steps' => 5,
'weight_decay' => 0,
'grad_clip_norm' => 10,
'adam' => [
'learning_rate' => 0.0001,
'beta1' => 0.9,
'beta2' => 0.95,
'eps' => 1e-8,
'weight_decay' => 0.1,
'grad_clip_norm' => 10
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step"
payload := strings.NewReader("{\n \"adam_params\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n },\n \"muon_params\": {\n \"learning_rate\": 0.02,\n \"momentum\": 0.95,\n \"newton_schulz_steps\": 5,\n \"weight_decay\": 0,\n \"grad_clip_norm\": 10,\n \"adam\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"adam_params\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n },\n \"muon_params\": {\n \"learning_rate\": 0.02,\n \"momentum\": 0.95,\n \"newton_schulz_steps\": 5,\n \"weight_decay\": 0,\n \"grad_clip_norm\": 10,\n \"adam\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"adam_params\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n },\n \"muon_params\": {\n \"learning_rate\": 0.02,\n \"momentum\": 0.95,\n \"newton_schulz_steps\": 5,\n \"weight_decay\": 0,\n \"grad_clip_norm\": 10,\n \"adam\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "TRAINING_OPERATION_STATUS_UNSPECIFIED",
"output": {
"step": "100"
},
"error": {
"code": "TRAINING_OPERATION_ERROR_CODE_TIMEOUT",
"message": "Operation timed out"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}Operations
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.
POST
/
rl
/
training-sessions
/
{session_id}
/
operations
/
optim-step
Optimizer step
curl --request POST \
--url https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"adam_params": {
"learning_rate": 0.0001,
"beta1": 0.9,
"beta2": 0.95,
"eps": 1e-8,
"weight_decay": 0.1,
"grad_clip_norm": 10
},
"muon_params": {
"learning_rate": 0.02,
"momentum": 0.95,
"newton_schulz_steps": 5,
"weight_decay": 0,
"grad_clip_norm": 10,
"adam": {
"learning_rate": 0.0001,
"beta1": 0.9,
"beta2": 0.95,
"eps": 1e-8,
"weight_decay": 0.1,
"grad_clip_norm": 10
}
}
}
'import requests
url = "https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step"
payload = {
"adam_params": {
"learning_rate": 0.0001,
"beta1": 0.9,
"beta2": 0.95,
"eps": 1e-8,
"weight_decay": 0.1,
"grad_clip_norm": 10
},
"muon_params": {
"learning_rate": 0.02,
"momentum": 0.95,
"newton_schulz_steps": 5,
"weight_decay": 0,
"grad_clip_norm": 10,
"adam": {
"learning_rate": 0.0001,
"beta1": 0.9,
"beta2": 0.95,
"eps": 1e-8,
"weight_decay": 0.1,
"grad_clip_norm": 10
}
}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
adam_params: {
learning_rate: 0.0001,
beta1: 0.9,
beta2: 0.95,
eps: 1e-8,
weight_decay: 0.1,
grad_clip_norm: 10
},
muon_params: {
learning_rate: 0.02,
momentum: 0.95,
newton_schulz_steps: 5,
weight_decay: 0,
grad_clip_norm: 10,
adam: {
learning_rate: 0.0001,
beta1: 0.9,
beta2: 0.95,
eps: 1e-8,
weight_decay: 0.1,
grad_clip_norm: 10
}
}
})
};
fetch('https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'adam_params' => [
'learning_rate' => 0.0001,
'beta1' => 0.9,
'beta2' => 0.95,
'eps' => 1e-8,
'weight_decay' => 0.1,
'grad_clip_norm' => 10
],
'muon_params' => [
'learning_rate' => 0.02,
'momentum' => 0.95,
'newton_schulz_steps' => 5,
'weight_decay' => 0,
'grad_clip_norm' => 10,
'adam' => [
'learning_rate' => 0.0001,
'beta1' => 0.9,
'beta2' => 0.95,
'eps' => 1e-8,
'weight_decay' => 0.1,
'grad_clip_norm' => 10
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step"
payload := strings.NewReader("{\n \"adam_params\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n },\n \"muon_params\": {\n \"learning_rate\": 0.02,\n \"momentum\": 0.95,\n \"newton_schulz_steps\": 5,\n \"weight_decay\": 0,\n \"grad_clip_norm\": 10,\n \"adam\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"adam_params\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n },\n \"muon_params\": {\n \"learning_rate\": 0.02,\n \"momentum\": 0.95,\n \"newton_schulz_steps\": 5,\n \"weight_decay\": 0,\n \"grad_clip_norm\": 10,\n \"adam\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.ai/v1/rl/training-sessions/{session_id}/operations/optim-step")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"adam_params\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n },\n \"muon_params\": {\n \"learning_rate\": 0.02,\n \"momentum\": 0.95,\n \"newton_schulz_steps\": 5,\n \"weight_decay\": 0,\n \"grad_clip_norm\": 10,\n \"adam\": {\n \"learning_rate\": 0.0001,\n \"beta1\": 0.9,\n \"beta2\": 0.95,\n \"eps\": 1e-8,\n \"weight_decay\": 0.1,\n \"grad_clip_norm\": 10\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "TRAINING_OPERATION_STATUS_UNSPECIFIED",
"output": {
"step": "100"
},
"error": {
"code": "TRAINING_OPERATION_ERROR_CODE_TIMEOUT",
"message": "Operation timed out"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Required key that makes retries return the original operation; use a new key for changed request bodies.
Path Parameters
Training session ID
Body
application/json
Response
Optimizer step operation details
Async optimizer step operation
Operation ID
Example:
"550e8400-e29b-41d4-a716-446655440000"
Operation status
Available options:
TRAINING_OPERATION_STATUS_UNSPECIFIED, TRAINING_OPERATION_STATUS_PENDING, TRAINING_OPERATION_STATUS_RUNNING, TRAINING_OPERATION_STATUS_COMPLETED, TRAINING_OPERATION_STATUS_FAILED Result on success
Show child attributes
Show child attributes
Error details on failure
Show child attributes
Show child attributes
Was this page helpful?
⌘I