Connect via SSH
Add your public key
SSH uses the public keys stored on your account. They are written to /root/.ssh/authorized_keys every time a pod starts, so add the key before you create or start the pod.
$ ssh-keygen -t ed25519 -C "you@example.com" # skip if you already have a key
$ apipods ssh-keys add ~/.ssh/id_ed25519.pubKeys added while a pod is running take effect after its next start or restart. To add one immediately, append it to /root/.ssh/authorized_keys from the web terminal.
Option 1: SSH gateway
The gateway works for every running pod, with any image, and needs no exposed ports.
$ ssh root@pod_8f2k1x9q.ssh.apipods.com -i ~/.ssh/id_ed25519scp, sftp, rsync and port forwarding need full SSH over TCP (option 2).Option 2: full SSH over TCP
Expose port 22 as tcp when you create the pod. The image must run an SSH server; all apipods/* images start sshd automatically. The pod object then shows the public address:
{
"port": 22,
"protocol": "tcp",
"publicIp": "203.0.113.42",
"publicPort": 40122
}$ ssh root@203.0.113.42 -p 40122 -i ~/.ssh/id_ed25519
# copy files
$ scp -P 40122 ./data.tar root@203.0.113.42:/workspace/
$ rsync -avz -e "ssh -p 40122" ./checkpoints/ root@203.0.113.42:/workspace/checkpoints/
# forward TensorBoard on the pod to localhost:6006
$ ssh -L 6006:localhost:6006 root@203.0.113.42 -p 40122Inside the pod the public port is available as APIPODS_TCP_PORT_22 and the address as APIPODS_PUBLIC_IP. The mapping stays the same while the pod runs on the same host, but can change after a stop and start.
Custom images without sshd
If your image does not run an SSH server, install and start one in your start command:
bash -c "apt-get update && apt-get install -y openssh-server && mkdir -p /run/sshd && /usr/sbin/sshd && exec python serve.py"The gateway (option 1) works without this.
VS Code and other IDEs
Add the pod to ~/.ssh/config and connect with VS Code Remote-SSH, JetBrains Gateway or Cursor:
Host llama-finetune
HostName 203.0.113.42
Port 40122
User root
IdentityFile ~/.ssh/id_ed25519Remote IDEs need full SSH over TCP. The CLI prints this block for you with apipods pods ssh pod_8f2k1x9q --config.