Wall-X API + Inference Tutorial
Wall-X API + Inference Tutorial
Wall-X API Usage Guide
Endpoint
URL: wss://maas-api.x2robot.com/v1/vla/wallx
Key: sk-yzwCH•••••••••••••••••••••••••••••Applying for an API Key
To apply for an API key, email wallxapi@x2robot.com. We suggest the subject line "Wall-X API Key Application - Name - Organization". Include the following information in the email body:
- Name: your full name
- Phone: a phone number where we can reach you
- Organization: the full name of your university, lab, or company
- Education: for example, undergraduate student, master's, PhD
- Occupation: for example, student, researcher, algorithm engineer
- Google Scholar: link to your profile (write "N/A" if you don't have one)
- GitHub: link to your profile
- Technical blog: link to your personal blog or other technical writing (write "N/A" if you don't have one)
- Test environment: real robot or simulation; for simulation, name the simulation platform
- Embodiment: for example, TeleTwin Desktop dual-arm teleoperation setup (G / H gripper), a real Quanta X1 Pro (G / H gripper)
| Real Robot | embodiment | Gripper Range |
|---|---|---|
| quanta_x1_pro / teletwin_desktop, G gripper | quanta_x1_pro, quanta_x1_pro/gripper-g, teletwin_desktop/gripper-g | [0, 1.526] |
| quanta_x1_pro / teletwin_desktop, H gripper | quanta_x1_pro/gripper-h, teletwin_desktop/gripper-h | [0, 4.6] |
quanta_x1_pro is the same as quanta_x1_pro/gripper-g. The gripper suffix must match the gripper on the robot. Use normalization: "provided" and send all three cameras. Do not send dof_mask, normalizer, or robot_id.
Positions and orientations are absolute values, in meters and radians. The service computes relative values internally. rotation_rpy is [roll, pitch, yaw], and the rotation matrix is Rz(yaw) · Ry(pitch) · Rx(roll). The left side of the image is the robot's right arm.
Dependencies: websockets, msgpack, and msgpack-numpy. Images are JPEGs captured at the same moment. You can send raw JPEG bytes (MessagePack bin, recommended) or Base64 strings (a data:image/jpeg;base64, prefix is allowed). The first frame after connecting is a handshake; read it before sending a request. The first inference warms up CUDA graphs, so allow a read timeout of tens of seconds. action_horizon is 32 and row_dt_s is 0.0337 s.
Below is a complete script. First put your assigned key in the WALLX_API_KEY environment variable, and replace the image paths and state with the measurements taken at that moment. For the H gripper, change the embodiment to quanta_x1_pro/gripper-h or teletwin_desktop/gripper-h, and fill in the gripper value within [0, 4.6].
Desktop Teleoperation Robot: TeleTwin Desktop
(1) Synchronous Inference
The teletwin_desktop desktop teleoperation setup runs zero-shot with both arms. The state contains only the left and right arms. A successful response contains only embodiment and actions, which hold the future leader-arm targets for both arms.
import os
from pathlib import Path
import msgpack
import msgpack_numpy
import websockets.sync.client
msgpack_numpy.patch()
def jpeg_bytes(path: str) -> bytes:
return Path(path).read_bytes() # send raw JPEG bytes; a Base64 string also works
payload = {
"embodiment": "teletwin_desktop/gripper-g",
"normalization": "provided",
"instruction": "folding clothes",
"observation": {
"images": {
"front": jpeg_bytes("front.jpg"),
"left_wrist": jpeg_bytes("left_wrist.jpg"),
"right_wrist": jpeg_bytes("right_wrist.jpg"),
},
"state": {
"left_ee": {
"position": [0.2905, 0.0224, 0.3754],
"rotation_rpy": [0.2968, -0.3565, -0.1049],
"gripper": 0.107,
},
"right_ee": {
"position": [0.2825, -0.0510, 0.3906],
"rotation_rpy": [0.0270, -0.5094, -0.3716],
"gripper": 0.119,
},
},
},
}
with websockets.sync.client.connect(
"wss://maas-api.x2robot.com/v1/vla/wallx", additional_headers={"Authorization": "Bearer " + os.environ["WALLX_API_KEY"]}, max_size=None, open_timeout=30
) as ws:
metadata = msgpack.unpackb(ws.recv())
assert metadata["model"] == "wall-x"
ws.send(msgpack.packb(payload))
response = msgpack.unpackb(ws.recv())
if isinstance(response, dict) and "error" in response:
err = response["error"]
raise RuntimeError(f"{err['code']}: {err['message']}")
print(response["embodiment"])
left = response["actions"]["left_ee"]
print(left["position"][0]) # xyz of frame 1
print(left["rotation_rpy"][0])
print(left["gripper"][0])Entries with the same index belong to the same frame. Only the first 2 frames are shown below.
{
"embodiment": "teletwin_desktop/gripper-g",
"actions": {
"left_ee": {
"position": [[0.3003, 0.0232, 0.3729], [0.3011, 0.0238, 0.3724]],
"rotation_rpy": [[0.3000, -0.4012, -0.0879], [0.3012, -0.4020, -0.0861]],
"gripper": [0.1044, 0.1040]
},
"right_ee": {
"position": [[0.2825, -0.0510, 0.3906], [0.2826, -0.0508, 0.3904]],
"rotation_rpy": [[0.0270, -0.5094, -0.3716], [0.0272, -0.5090, -0.3710]],
"gripper": [0.1188, 0.1186]
}
}
}(2) RTC Asynchronous Inference
RTC stitches two consecutive predictions together. While the robot is still executing frames sent from the previous round, the new prediction must continue from after those frames, so the two trajectories do not diverge where they meet.
The teletwin_desktop desktop teleoperation setup runs the loop below. Consecutive frames are 33.7 ms apart. Each round sends only 6 frames, about 0.2 s, then requests again with new images and state.
- Send the first request as in section (1). Do not include
use_rtc,inference_delay, orprev_action_chunk; there is no previous trajectory yet. - When you get
actions, send indices 0 to 5 to the robot. The left and right arms execute the same index together. Keep all 32 frames. - After 6 frames have been sent, send the next request. This request includes three fields:
- Set
use_rtctotrue. - Set
inference_delayto the number of frames that will still be executing at the start of this round. It must be an integer: 1, 2, 3, or 4. The desktop teleoperation setup uses 4. A value of 5 or 6 returnsrtc_delay_exceeds_training. 6 is the number of frames sent per round, not this field. - Build
prev_action_chunkfrom the previous round'sactions. It has the same structure: both arms needposition,rotation_rpy, andgripper, with at least 2 frames.
- Set
- From the new
actions, again send 6 frames starting at index 0, then repeat step 3. Eachprev_action_chunkcomes from theactionsyou just received.
Here is how to build prev_action_chunk. Suppose the previous round's left gripper was:
[0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, ...]
0 1 2 3 4 5 6 7The first 6 frames, 0.10 to 0.15, have already been sent. In the next request, keep frame 0 and append the frames from index 6 onward:
[0.10, 0.16, 0.17, ...]The service discards the frame 0 it receives, so 0.10 must stay in the array. The frames pinned to the start of the new prediction are the not-yet-executed frames from 0.16 onward. Slice position and rotation_rpy at the same indices. rtc_mode and num_flow_steps are optional; when omitted, the server uses training_time. A successful response still contains only embodiment and actions.
The script below chains the first request from section (1) and the next request from step 3. Replace the images and state with the measurements taken at that moment.
import os
from pathlib import Path
import msgpack
import msgpack_numpy
import websockets.sync.client
msgpack_numpy.patch()
EXECUTED = 6 # frames sent to the robot each round
DELAY = 4 # inference_delay; must be 1, 2, 3, or 4
def jpeg_bytes(path: str) -> bytes:
return Path(path).read_bytes() # send raw JPEG bytes; a Base64 string also works
def observe(instruction: str) -> dict:
return {
"embodiment": "teletwin_desktop/gripper-g",
"normalization": "provided",
"instruction": instruction,
"observation": {
"images": {
"front": jpeg_bytes("front.jpg"),
"left_wrist": jpeg_bytes("left_wrist.jpg"),
"right_wrist": jpeg_bytes("right_wrist.jpg"),
},
"state": {
"left_ee": {
"position": [0.3003, 0.0232, 0.3729],
"rotation_rpy": [0.3000, -0.4012, -0.0879],
"gripper": 0.104,
},
"right_ee": {
"position": [0.2825, -0.0510, 0.3906],
"rotation_rpy": [0.0270, -0.5094, -0.3716],
"gripper": 0.119,
},
},
},
}
def shift_chunk(actions: dict, executed: int = EXECUTED) -> dict:
# Keep frame 0, then append the frames not yet sent (index `executed` onward).
chunk = {}
for arm, block in actions.items():
chunk[arm] = {
key: [frames[0], *frames[executed:]]
for key, frames in block.items()
}
return chunk
def ask(ws, payload: dict) -> dict:
ws.send(msgpack.packb(payload))
response = msgpack.unpackb(ws.recv())
if isinstance(response, dict) and "error" in response:
err = response["error"]
raise RuntimeError(f"{err['code']}: {err['message']}")
return response
with websockets.sync.client.connect(
"wss://maas-api.x2robot.com/v1/vla/wallx", additional_headers={"Authorization": "Bearer " + os.environ["WALLX_API_KEY"]}, max_size=None, open_timeout=30
) as ws:
metadata = msgpack.unpackb(ws.recv())
assert metadata["model"] == "wall-x"
# Step 1: the first request has no previous trajectory.
first = ask(ws, observe("folding clothes"))
# Step 2: send indices 0 to 5 of first["actions"]. Continue here with new images and state.
# Step 3: turn on RTC for the next request.
nxt = observe("folding clothes")
nxt["use_rtc"] = True
nxt["inference_delay"] = DELAY
nxt["prev_action_chunk"] = shift_chunk(first["actions"])
second = ask(ws, nxt)
# Step 4: send indices 0 to 5 of second["actions"], then repeat step 3 with second["actions"].
print(second["embodiment"])
print(second["actions"]["left_ee"]["position"][0])Quanta X1 Pro: Quanta_X1_Pro
Head, lift, and chassis actions on the Quanta X1 Pro have not been fully tested yet, so we recommend using only the two arms. The request can still include these three states; use return_body to turn off the corresponding actions. The request interface is the same as for TeleTwin Desktop. In the request, change the embodiment to:
"embodiment": "quanta_x1_pro/gripper-g",For example:
payload = {
"embodiment": "quanta_x1_pro/gripper-g",
"normalization": "provided",
"instruction": "folding clothes",
"observation": {
"images": {
"front": jpeg_bytes("front.jpg"),
"left_wrist": jpeg_bytes("left_wrist.jpg"),
"right_wrist": jpeg_bytes("right_wrist.jpg"),
},
"state": {
"left_ee": {
"position": [0.2905, 0.0224, 0.3754],
"rotation_rpy": [0.2968, -0.3565, -0.1049],
"gripper": 0.107,
},
"right_ee": {
"position": [0.2825, -0.0510, 0.3906],
"rotation_rpy": [0.0270, -0.5094, -0.3716],
"gripper": 0.119,
},
},
},
}Request and Response Fields
Zero-shot on the desktop teleoperation setup uses only the fields marked "required" in the table below. Head, lift, and chassis are optional fields for quanta_x1_pro; see the note below the table.
(1) Request
| Field | Shape | Description |
|---|---|---|
embodiment | string | quanta_x1_pro, quanta_x1_pro/gripper-g, quanta_x1_pro/gripper-h, teletwin_desktop/gripper-g, teletwin_desktop/gripper-h |
normalization | string | Always provided |
instruction | string | The task for this step |
observation.images.front | JPEG | Head camera, required |
observation.images.left_wrist | JPEG | Left wrist camera, required |
observation.images.right_wrist | JPEG | Right wrist camera, required |
state.left_ee.position | 3 | Left end effector [x, y, z], meters, required |
state.left_ee.rotation_rpy | 3 | Left arm [roll, pitch, yaw], radians, required |
state.left_ee.gripper | 1 | Left gripper opening, required |
state.right_ee.position | 3 | Right end effector [x, y, z], meters, required |
state.right_ee.rotation_rpy | 3 | Right arm [roll, pitch, yaw], radians, required |
state.right_ee.gripper | 1 | Right gripper opening, required |
Arm positions and orientations are absolute values in the robot base frame. G gripper range is [0, 1.526]; H gripper range is [0, 4.6].
Optional fields (Quanta X1 Pro):
state.head_pose: shape 2,[yaw, pitch], radians.state.lift: shape 1, lift height, meters.state.car_pose: shape 3, chassis velocity[vx, vy, wz](a velocity, not a pose).- Top-level
return_body: for example{"car_pose": false, "head_pose": false, "lift": false}. The server returns no actions for parts set to false.
(2) Response
The fields always present for the two arms are listed in the table below. If the request includes head, lift, or chassis state and return_body does not turn them off, actions also contains head_pose [32, 2], lift [32], and velocity_decomposed_odom [32, 3] (chassis velocity [vx, vy, wz]).
Chassis field names at a glance:
- Request
state.car_poseis a velocity. extra_state.car_pose, which the client attaches, is the pose relative to the start[x, y, yaw]; the server does not read it.- In the response, the chassis action is called
velocity_decomposed_odom. - In
return_body,car_poseswitches the chassis on or off.
Each item in actions has 32 frames; entries with the same index belong to the same frame.
| Field | Shape | Description |
|---|---|---|
embodiment | string | Echoes the name from the request |
actions.left_ee.position | [32, 3] | Future left arm positions, meters |
actions.left_ee.rotation_rpy | [32, 3] | Future left arm orientations, radians |
actions.left_ee.gripper | [32] | Left gripper |
actions.right_ee.position | [32, 3] | Future right arm positions, meters |
actions.right_ee.rotation_rpy | [32, 3] | Future right arm orientations, radians |
actions.right_ee.gripper | [32] | Right gripper |
Common Errors
| code | When it occurs |
|---|---|
unknown_embodiment | The name is not one of quanta_x1_pro, quanta_x1_pro/gripper-g, quanta_x1_pro/gripper-h, teletwin_desktop/gripper-g, teletwin_desktop/gripper-h. Uppercase gripper-G also fails |
missing_field | Empty instruction, a missing camera, or a missing position, rotation_rpy, or gripper for either arm |
image_decode_failed | An image is not a valid JPEG (bytes or Base64 string) |
mixed_schema | Both embodiment and norm_key are present, or both observation and views |
normalization_conflict | provided is used together with normalizer, or an arm state is given as rotation_6d |