VibeTunnel
Manage VibeTunnel terminal sessions via REST API. Create, list, monitor, and control sessions visible in the web dashboard.
Setup
VibeTunnel must be running. Default: http://localhost:8080. Override with VT_URL env var.
Health Check
CODEBLOCK0
List Sessions
CODEBLOCK1
Compact view:
CODEBLOCK2
Create Session
CODEBLOCK3
Parameters:
- -
command: array — command + args (default: ["zsh", "-l", "-i"]) - INLINECODE4 : string — display name
- INLINECODE5 : string — working directory
- INLINECODE6 : number — terminal width (default: 120)
- INLINECODE7 : number — terminal height (default: 30)
Get Session
CODEBLOCK4
Delete Session
CODEBLOCK5
Send Input
CODEBLOCK6
Note: include \n to execute the command.
Resize Session
CODEBLOCK7
Examples
Launch Claude Code session:
CODEBLOCK8
Launch tmux session:
CODEBLOCK9
Clean up exited sessions:
CODEBLOCK10
Environment Variables
| Variable | Default | Description |
|---|
| INLINECODE9 | INLINECODE10 | VibeTunnel server URL |
VibeTunnel
通过 REST API 管理 VibeTunnel 终端会话。可创建、列出、监控和控制 Web 仪表板中可见的会话。
设置
VibeTunnel 必须处于运行状态。默认地址:http://localhost:8080。可通过 VT_URL 环境变量覆盖。
健康检查
bash
curl -s ${VT_URL:-http://localhost:8080}/api/health | jq .
列出会话
bash
curl -s ${VT_URL:-http://localhost:8080}/api/sessions | jq .
紧凑视图:
bash
curl -s ${VT_URL:-http://localhost:8080}/api/sessions | jq -r .[] | \(.status | if . == running then ● else ○ end) \(.name) [\(.id | .[0:8])]
创建会话
bash
curl -s -X POST ${VT_URL:-http://localhost:8080}/api/sessions \
-H Content-Type: application/json \
-d {command: [zsh, -l, -i], name: my-session, workingDir: /path/to/dir} | jq .
参数:
- - command:数组 — 命令及参数(默认值:[zsh, -l, -i])
- name:字符串 — 显示名称
- workingDir:字符串 — 工作目录
- cols:数字 — 终端宽度(默认值:120)
- rows:数字 — 终端高度(默认值:30)
获取会话
bash
curl -s ${VT_URL:-http://localhost:8080}/api/sessions/
| jq .
删除会话
bash
curl -s -X DELETE ${VT_URL:-http://localhost:8080}/api/sessions/ | jq .
发送输入
bash
curl -s -X POST ${VT_URL:-http://localhost:8080}/api/sessions//input \
-H Content-Type: application/json \
-d {text: ls -la\n} | jq .
注意:包含 \n 以执行命令。
调整会话大小
bash
curl -s -X POST ${VT_URL:-http://localhost:8080}/api/sessions//resize \
-H Content-Type: application/json \
-d {cols: 150, rows: 40} | jq .
示例
启动 Claude Code 会话:
bash
curl -s -X POST ${VT_URL:-http://localhost:8080}/api/sessions \
-H Content-Type: application/json \
-d {command: [claude], name: claude-code, workingDir: ~/repos/my-project} | jq .
启动 tmux 会话:
bash
curl -s -X POST ${VT_URL:-http://localhost:8080}/api/sessions \
-H Content-Type: application/json \
-d {command: [tmux, new, -A, -s, work], name: tmux-work} | jq .
清理已退出的会话:
bash
curl -s ${VT_URL:-http://localhost:8080}/api/sessions | jq -r .[] | select(.status == exited) | .id | \
xargs -I {} curl -s -X DELETE ${VT_URL:-http://localhost:8080}/api/sessions/{}
环境变量
| 变量 | 默认值 | 描述 |
|---|
| VT_URL | http://localhost:8080 | VibeTunnel 服务器 URL |