Please rotate your device

To continue exploring this website, please rotate your device to a vertical orientation

NVIDIA Cosmos 3 Nano (8B)

NVIDIA/NVIDIA Cosmos 3 Nano (8B)

NVIDIA Cosmos 3 Nano (8B) world foundation model with six omni modes: text2image, text2video, image2video, forward/inverse dynamics, and policy. Single H100.

image generation

text2image — render a single still image from a text prompt (num_frames: 1). Returns a base64 JPEG.

Input

python
import base64
import os

import requests

# Find MODEL_ID in the Baseten dashboard: Models -> your deployment -> API.
MODEL_ID = "YOUR_MODEL_ID"
BASETEN_API_KEY = os.environ["BASETEN_API_KEY"]

resp = requests.post(
    f"https://model-{MODEL_ID}.api.baseten.co/environments/production/predict",
    headers={"Authorization": f"Api-Key {BASETEN_API_KEY}"},
    json={
        "model_mode": "text2image",
        "prompt": "A medium shot of a modern robotics research laboratory with white walls and a gray floor.",
        "resolution": "720",
        "aspect_ratio": "16,9",
        "num_frames": 1,
        "seed": 0
    },
)
resp.raise_for_status()
out = resp.json()

# Vision modes return base64-encoded media in `data`.
with open(f"vision.{out['format']}", "wb") as f:
    f.write(base64.b64decode(out["data"]))
print(f"saved vision.{out['format']}")
bash
# export MODEL_ID=... and BASETEN_API_KEY=... first
curl -X POST \
  "https://model-${MODEL_ID}.api.baseten.co/environments/production/predict" \
  -H "Authorization: Api-Key ${BASETEN_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"model_mode": "text2image", "prompt": "A medium shot of a modern robotics research laboratory with white walls and a gray floor.", "resolution": "720", "aspect_ratio": "16,9", "num_frames": 1, "seed": 0}'

Output

json
{
  "name": "<sample-name>",
  "model_mode": "text2image",
  "format": "jpg",
  "data": "<base64-encoded media>"
}

text2video (default mode) — generate a video clip from a text prompt. Returns a base64 MP4.

Input

python
import base64
import os

import requests

# Find MODEL_ID in the Baseten dashboard: Models -> your deployment -> API.
MODEL_ID = "YOUR_MODEL_ID"
BASETEN_API_KEY = os.environ["BASETEN_API_KEY"]

resp = requests.post(
    f"https://model-{MODEL_ID}.api.baseten.co/environments/production/predict",
    headers={"Authorization": f"Api-Key {BASETEN_API_KEY}"},
    json={
        "model_mode": "text2video",
        "prompt": "A bustling city street at night, neon signs reflecting on wet pavement, light rain falling.",
        "resolution": "720",
        "aspect_ratio": "16,9",
        "num_frames": 189,
        "fps": 24,
        "seed": 0
    },
)
resp.raise_for_status()
out = resp.json()

# Vision modes return base64-encoded media in `data`.
with open(f"vision.{out['format']}", "wb") as f:
    f.write(base64.b64decode(out["data"]))
print(f"saved vision.{out['format']}")
bash
# export MODEL_ID=... and BASETEN_API_KEY=... first
curl -X POST \
  "https://model-${MODEL_ID}.api.baseten.co/environments/production/predict" \
  -H "Authorization: Api-Key ${BASETEN_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"model_mode": "text2video", "prompt": "A bustling city street at night, neon signs reflecting on wet pavement, light rain falling.", "resolution": "720", "aspect_ratio": "16,9", "num_frames": 189, "fps": 24, "seed": 0}'

Output

json
{
  "name": "<sample-name>",
  "model_mode": "text2video",
  "format": "mp4",
  "data": "<base64-encoded media>"
}

image2video — animate a still image conditioned on a text prompt. For best results, pass a structured prompt (scene, subject, action, motion, camera, temporal_sequence, constraints) JSON-encoded as a string in the prompt field, per NVIDIA's recommendation. Provide the first frame as vision_path (URL or container path). Returns a base64 MP4.

Input

python
import base64
import json
import os

import requests

# Find MODEL_ID in the Baseten dashboard: Models -> your deployment -> API.
MODEL_ID = "YOUR_MODEL_ID"
BASETEN_API_KEY = os.environ["BASETEN_API_KEY"]

# Cosmos 3 prefers a *structured* prompt for image2video. Describe the scene,
# subject, action, motion, camera, temporal sequence, and constraints, then
# pass it JSON-encoded as a string in the `prompt` field.
prompt = {
    "scene": "A modern robotics lab with a robotic arm, red spherical object, metal shelf, white walls, and gray floor.",
    "subject": "The robotic arm",
    "action": "picks up the red spherical object and places it on the lower shelf",
    "motion": {
        "type": "smooth deliberate manipulation",
        "speed": "slow and controlled",
        "trajectory": "arm moves from tabletop to lower shelf",
    },
    "camera": {
        "movement": "locked-off static camera",
        "framing": "medium shot",
        "preserve_composition": True,
    },
    "temporal_sequence": [
        "The gripper approaches the red sphere",
        "The gripper closes around the sphere",
        "The arm lifts the sphere",
        "The arm moves to the lower shelf",
        "The gripper releases the sphere",
    ],
    "constraints": [
        "Preserve the identity and layout of the input image",
        "Do not introduce new objects",
        "Keep lighting and background consistent",
        "Avoid fast or jerky motion",
    ],
}

resp = requests.post(
    f"https://model-{MODEL_ID}.api.baseten.co/environments/production/predict",
    headers={"Authorization": f"Api-Key {BASETEN_API_KEY}"},
    json={
        "model_mode": "image2video",
        "vision_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/vision/robot_153.jpg",
        "prompt": json.dumps(prompt),
        "resolution": "720",
        "aspect_ratio": "16,9",
        "num_frames": 189,
        "fps": 24,
        "seed": 0,
    },
)
resp.raise_for_status()
out = resp.json()

# Vision modes return base64-encoded media in `data`.
with open(f"vision.{out['format']}", "wb") as f:
    f.write(base64.b64decode(out["data"]))
print(f"saved vision.{out['format']}")
bash
# export MODEL_ID=... and BASETEN_API_KEY=... first
# Cosmos 3 prefers a structured prompt for image2video, passed as a JSON-encoded string in `prompt`.
curl -X POST \
  "https://model-${MODEL_ID}.api.baseten.co/environments/production/predict" \
  -H "Authorization: Api-Key ${BASETEN_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"model_mode": "image2video", "vision_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/vision/robot_153.jpg", "prompt": "{\"scene\": \"A modern robotics lab with a robotic arm, red spherical object, metal shelf, white walls, and gray floor.\", \"subject\": \"The robotic arm\", \"action\": \"picks up the red spherical object and places it on the lower shelf\", \"motion\": {\"type\": \"smooth deliberate manipulation\", \"speed\": \"slow and controlled\", \"trajectory\": \"arm moves from tabletop to lower shelf\"}, \"camera\": {\"movement\": \"locked-off static camera\", \"framing\": \"medium shot\", \"preserve_composition\": true}, \"temporal_sequence\": [\"The gripper approaches the red sphere\", \"The gripper closes around the sphere\", \"The arm lifts the sphere\", \"The arm moves to the lower shelf\", \"The gripper releases the sphere\"], \"constraints\": [\"Preserve the identity and layout of the input image\", \"Do not introduce new objects\", \"Keep lighting and background consistent\", \"Avoid fast or jerky motion\"]}", "resolution": "720", "aspect_ratio": "16,9", "num_frames": 189, "fps": 24, "seed": 0}'

Output

json
{
  "name": "<sample-name>",
  "model_mode": "image2video",
  "format": "mp4",
  "data": "<base64-encoded media>"
}

forward_dynamics — predict the future video rollout from an initial observation plus an action sequence (vision_path + action_path). Returns a base64 MP4.

Input

python
import base64
import os

import requests

# Find MODEL_ID in the Baseten dashboard: Models -> your deployment -> API.
MODEL_ID = "YOUR_MODEL_ID"
BASETEN_API_KEY = os.environ["BASETEN_API_KEY"]

resp = requests.post(
    f"https://model-{MODEL_ID}.api.baseten.co/environments/production/predict",
    headers={"Authorization": f"Api-Key {BASETEN_API_KEY}"},
    json={
        "model_mode": "forward_dynamics",
        "vision_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/action/bridge_0.mp4",
        "action_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/action/bridge_0.json",
        "prompt": "Put the pot to the left of the purple item. This video is captured from a first-person perspective looking at the scene.",
        "image_size": 480,
        "fps": 5,
        "num_steps": 30,
        "guidance": 1.0,
        "shift": 5.0,
        "seed": 0,
        "action_chunk_size": 16,
        "domain_name": "bridge_orig_lerobot"
    },
)
resp.raise_for_status()
out = resp.json()

# Vision modes return base64-encoded media in `data`.
with open(f"vision.{out['format']}", "wb") as f:
    f.write(base64.b64decode(out["data"]))
print(f"saved vision.{out['format']}")
bash
# export MODEL_ID=... and BASETEN_API_KEY=... first
curl -X POST \
  "https://model-${MODEL_ID}.api.baseten.co/environments/production/predict" \
  -H "Authorization: Api-Key ${BASETEN_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"model_mode": "forward_dynamics", "vision_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/action/bridge_0.mp4", "action_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/action/bridge_0.json", "prompt": "Put the pot to the left of the purple item. This video is captured from a first-person perspective looking at the scene.", "image_size": 480, "fps": 5, "num_steps": 30, "guidance": 1.0, "shift": 5.0, "seed": 0, "action_chunk_size": 16, "domain_name": "bridge_orig_lerobot"}'

Output

json
{
  "name": "<sample-name>",
  "model_mode": "forward_dynamics",
  "format": "mp4",
  "data": "<base64-encoded media>"
}

inverse_dynamics — infer the action sequence that produced an observed video. Returns the action tensor under sample_outputs.

Input

python
import base64
import os

import requests

# Find MODEL_ID in the Baseten dashboard: Models -> your deployment -> API.
MODEL_ID = "YOUR_MODEL_ID"
BASETEN_API_KEY = os.environ["BASETEN_API_KEY"]

resp = requests.post(
    f"https://model-{MODEL_ID}.api.baseten.co/environments/production/predict",
    headers={"Authorization": f"Api-Key {BASETEN_API_KEY}"},
    json={
        "model_mode": "inverse_dynamics",
        "vision_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/action/av_vision_25_73d01c91-51f0-46cf-9b76-5682a76fb349.mp4",
        "prompt": "You are an autonomous vehicle planning system. This video is captured from a first-person perspective looking at the scene.",
        "image_size": 480,
        "fps": 10,
        "num_steps": 30,
        "guidance": 1.0,
        "shift": 5.0,
        "seed": 0,
        "raw_action_dim": 9,
        "action_chunk_size": 60,
        "domain_name": "av"
    },
)
resp.raise_for_status()
out = resp.json()

# Action modes return the predicted action tensor under sample_outputs.
actions = out["sample_outputs"]["outputs"][0]["content"]["action"]
print(f"{len(actions)} action steps")
print(actions[0])
bash
# export MODEL_ID=... and BASETEN_API_KEY=... first
curl -X POST \
  "https://model-${MODEL_ID}.api.baseten.co/environments/production/predict" \
  -H "Authorization: Api-Key ${BASETEN_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"model_mode": "inverse_dynamics", "vision_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/action/av_vision_25_73d01c91-51f0-46cf-9b76-5682a76fb349.mp4", "prompt": "You are an autonomous vehicle planning system. This video is captured from a first-person perspective looking at the scene.", "image_size": 480, "fps": 10, "num_steps": 30, "guidance": 1.0, "shift": 5.0, "seed": 0, "raw_action_dim": 9, "action_chunk_size": 60, "domain_name": "av"}'

Output

json
{
  "name": "<sample-name>",
  "model_mode": "inverse_dynamics",
  "format": "mp4",
  "data": "<base64 of input video echoed back>",
  "sample_outputs": {
    "status": "success",
    "outputs": [
      {
        "content": {
          "action": [
            [
              "..."
            ],
            [
              "..."
            ]
          ]
        },
        "files": [
          "..."
        ]
      }
    ]
  }
}

policy — predict the actions needed to reach a goal (described in the prompt) from a starting observation. Returns the action tensor under sample_outputs.

Input

python
import base64
import os

import requests

# Find MODEL_ID in the Baseten dashboard: Models -> your deployment -> API.
MODEL_ID = "YOUR_MODEL_ID"
BASETEN_API_KEY = os.environ["BASETEN_API_KEY"]

resp = requests.post(
    f"https://model-{MODEL_ID}.api.baseten.co/environments/production/predict",
    headers={"Authorization": f"Api-Key {BASETEN_API_KEY}"},
    json={
        "model_mode": "policy",
        "vision_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/action/bridge_0.mp4",
        "prompt": "Put the pot to the left of the purple item. This video is captured from a first-person perspective looking at the scene.",
        "image_size": 480,
        "fps": 5,
        "num_steps": 30,
        "guidance": 1.0,
        "shift": 5.0,
        "seed": 0,
        "action_chunk_size": 16,
        "raw_action_dim": 10,
        "domain_name": "bridge_orig_lerobot"
    },
)
resp.raise_for_status()
out = resp.json()

# Action modes return the predicted action tensor under sample_outputs.
actions = out["sample_outputs"]["outputs"][0]["content"]["action"]
print(f"{len(actions)} action steps")
print(actions[0])
bash
# export MODEL_ID=... and BASETEN_API_KEY=... first
curl -X POST \
  "https://model-${MODEL_ID}.api.baseten.co/environments/production/predict" \
  -H "Authorization: Api-Key ${BASETEN_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"model_mode": "policy", "vision_path": "https://github.com/nvidia-cosmos/cosmos-dependencies/raw/refs/heads/assets/cosmos3/inputs/action/bridge_0.mp4", "prompt": "Put the pot to the left of the purple item. This video is captured from a first-person perspective looking at the scene.", "image_size": 480, "fps": 5, "num_steps": 30, "guidance": 1.0, "shift": 5.0, "seed": 0, "action_chunk_size": 16, "raw_action_dim": 10, "domain_name": "bridge_orig_lerobot"}'

Output

json
{
  "name": "<sample-name>",
  "model_mode": "policy",
  "format": "mp4",
  "data": "<base64 of input video echoed back>",
  "sample_outputs": {
    "status": "success",
    "outputs": [
      {
        "content": {
          "action": [
            [
              "..."
            ],
            [
              "..."
            ]
          ]
        },
        "files": [
          "..."
        ]
      }
    ]
  }
}