curl --request POST \
--url https://compute.x402layer.cc/pods/{id}/coding/ssh \
--header 'Content-Type: application/json' \
--data '
{
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop"
}
'import requests
url = "https://compute.x402layer.cc/pods/{id}/coding/ssh"
payload = { "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop'})
};
fetch('https://compute.x402layer.cc/pods/{id}/coding/ssh', 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://compute.x402layer.cc/pods/{id}/coding/ssh",
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([
'public_key' => 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://compute.x402layer.cc/pods/{id}/coding/ssh"
payload := strings.NewReader("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://compute.x402layer.cc/pods/{id}/coding/ssh")
.header("Content-Type", "application/json")
.body("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://compute.x402layer.cc/pods/{id}/coding/ssh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop\"\n}"
response = http.request(request)
puts response.read_body{
"ticket": "<string>",
"ttl_seconds": 60,
"path": "/pods/screen/<ticket>",
"user": "node"
}Open an SSH connection to a Coding sandbox
Mints a single-use ticket for one SSH connection to a Coding sandbox. Most people use the CLI instead (singularity sandbox ssh-config, from CLI 0.6.0), which runs this as ssh’s ProxyCommand so ssh, scp, sftp, port forwarding and VS Code / Cursor Remote-SSH work.
The ticket is bound to the public key you send: the sandbox starts an SSH server for this one connection that accepts only that key, and logs you in as the sandbox user (user in the answer). No passwords. Open wss://compute.x402layer.cc + path within ttl_seconds (60); the ticket works once. Binary frames carry the SSH byte stream both ways.
A sandbox made before SSH existed answers 409 with code ssh_setting_up and retry_after_seconds the first time: SSH is being set up on it (about a minute, once). A sleeping sandbox wakes. An open connection keeps it awake (awake hours count as usual).
Auth: a compute API key (X-API-Key) with pods:control:write, or a wallet signature, same as /compute/*. Keys from a Google, GitHub or X login work here.
curl --request POST \
--url https://compute.x402layer.cc/pods/{id}/coding/ssh \
--header 'Content-Type: application/json' \
--data '
{
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop"
}
'import requests
url = "https://compute.x402layer.cc/pods/{id}/coding/ssh"
payload = { "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop'})
};
fetch('https://compute.x402layer.cc/pods/{id}/coding/ssh', 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://compute.x402layer.cc/pods/{id}/coding/ssh",
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([
'public_key' => 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://compute.x402layer.cc/pods/{id}/coding/ssh"
payload := strings.NewReader("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://compute.x402layer.cc/pods/{id}/coding/ssh")
.header("Content-Type", "application/json")
.body("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://compute.x402layer.cc/pods/{id}/coding/ssh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... me@laptop\"\n}"
response = http.request(request)
puts response.read_body{
"ticket": "<string>",
"ttl_seconds": 60,
"path": "/pods/screen/<ticket>",
"user": "node"
}Body
Was this page helpful?
