Skip to main content
A Coding sandbox is a coding agent (Claude Code, Codex, OpenCode or Pi) on its own private computer, run by Singularity Layer. It is an Agent Pod with agent_id coding. It sleeps after 15 idle minutes and wakes when you use it. Besides the browser, you can:
  • open its terminal from your own machine with singularity sandbox connect,
  • run commands and move files from a script,
  • talk to its coding agent from any OpenAI client.

What you need

A compute API key from Settings > API keys with the Agent Pods permission Read and write pod files, install skills, create and restore backups (pods:control:write), or a Solana keypair.

From your terminal

The sandbox command is available from CLI 0.5.0.
  • connect needs Node 22 or newer.
  • With more than one sandbox, name it: its id, the first few characters of the id, or its name (singularity sandbox connect 99a7).
  • --keypair <path> signs with a Solana keypair instead of a key. --json gives machine-readable output.

Terminal over WebSocket

The same path the browser terminal uses. The connection is relayed through the sandbox’s own outbound link: no SSH, no open port.
  • Open wss://compute.x402layer.cc followed by path. The ticket works once, within 60 seconds.
  • Send a text frame {"cols": 120, "rows": 40} to set the terminal size.
  • Binary frames you send are keystrokes. Binary frames you receive are terminal output.
  • Close code 4006 means the terminal closed after 10 idle minutes.
Reference

Run a command, read and write files

The Sandbox API works on a Coding sandbox. A sleeping sandbox wakes for these calls.
Text files up to 256 KB, with at most 128 KB per request. See Run a command, Read files and Write a file.

An OpenAI-compatible address

Create a key for the sandbox. It is shown once.
Then point any OpenAI client at the base URL with model agent-pod:
  • GET /v1/models and POST /v1/chat/completions. With "stream": true you get chat.completion.chunk events ending with data: [DONE].
  • Each request is one turn of the sandbox’s coding agent. Up to 1000 requests per key per day.
  • OpenCode and Pi on Singularity Layer models use your credits. Claude Code runs only on your own Claude login or Anthropic key.
The coding agent can edit files and run commands in the sandbox. Treat the key like a password. Revoke it with singularity sandbox revoke-key or DELETE /pods/v1/pods/{id}/keys/{keyId}.
See also OpenAI-compatible adapter and Create a pod key.

Other ways in

  • MCP: cloud_pod_exec, cloud_pod_files and cloud_pod_write_file on the Singularity MCP work on a Coding sandbox.
  • Skills: references/coding-sandbox.md in the x402-compute skill.