Skip to content

Commit 7747f76

Browse files
committed
refac
1 parent 0a8af6d commit 7747f76

1 file changed

Lines changed: 10 additions & 67 deletions

File tree

README.md

Lines changed: 10 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# ⚡ Open Terminal
22

3-
A lightweight API for running shell commands remotely — with real-time streaming and secure access.
3+
A lightweight API for running shell commands remotely — designed for AI agents and automation.
4+
5+
The container ships with a full toolkit (Python, git, jq, curl, build tools, and more) and runs as a non-root user with passwordless `sudo`.
46

57
## Getting Started
68

@@ -19,93 +21,34 @@ docker build -t open-terminal .
1921
docker run -p 8000:8000 open-terminal
2022
```
2123

22-
### Bare Metal (if you like to live dangerously)
24+
### Bare Metal
2325

2426
```bash
2527
pip install open-terminal
2628
open-terminal run --host 0.0.0.0 --port 8000 --api-key your-secret-key
2729
```
2830

29-
| Option | Default | Env Var | Description |
30-
|---|---|---|---|
31-
| `--host` | `0.0.0.0` || Bind address |
32-
| `--port` | `8000` || Bind port |
33-
| `--api-key` | auto-generated | `OPEN_TERMINAL_API_KEY` | Bearer API key |
34-
35-
## Usage
31+
## Quick Examples
3632

37-
### Run a Command
33+
**Run a command:**
3834

3935
```bash
40-
curl -X POST http://localhost:8000/execute \
36+
curl -X POST http://localhost:8000/execute?wait=5 \
4137
-H "Authorization: Bearer <api-key>" \
4238
-H "Content-Type: application/json" \
4339
-d '{"command": "echo hello"}'
4440
```
4541

46-
### Stream Output
42+
**Upload a file:**
4743

4844
```bash
49-
curl -X POST "http://localhost:8000/execute?stream=true" \
50-
-H "Authorization: Bearer <api-key>" \
51-
-H "Content-Type: application/json" \
52-
-d '{"command": "for i in 1 2 3; do echo $i; sleep 1; done"}'
53-
```
54-
55-
Output streams as JSONL:
56-
57-
```jsonl
58-
{"type": "stdout", "data": "1\n"}
59-
{"type": "stdout", "data": "2\n"}
60-
{"type": "stdout", "data": "3\n"}
61-
{"type": "exit", "data": 0}
62-
```
63-
64-
### Upload a File
65-
66-
**From URL:**
67-
```bash
68-
curl -X POST "http://localhost:8000/files/upload?url=https://example.com/data.csv&dir=/tmp" \
45+
curl -X POST "http://localhost:8000/files/upload?directory=/home/user&url=https://example.com/data.csv" \
6946
-H "Authorization: Bearer <api-key>"
7047
```
7148

72-
**Direct upload:**
73-
```bash
74-
curl -X POST "http://localhost:8000/files/upload?dir=/tmp" \
75-
-H "Authorization: Bearer <api-key>" \
76-
-F "file=@local_file.csv"
77-
```
78-
79-
**Via temporary link (no auth needed to upload):**
80-
```bash
81-
# 1. Generate an upload link
82-
curl -X POST "http://localhost:8000/files/upload/link?dir=/tmp" \
83-
-H "Authorization: Bearer <api-key>"
84-
# → {"url": "http://localhost:8000/files/upload/a1b2c3d4..."}
85-
86-
# 2. Upload to the link (no auth required)
87-
curl -X POST "http://localhost:8000/files/upload/a1b2c3d4..." \
88-
-F "file=@local_file.csv"
89-
```
90-
91-
Filename is automatically derived from the uploaded file or URL.
92-
93-
### Download a File
94-
95-
```bash
96-
curl "http://localhost:8000/files/download/link?path=/tmp/output.csv" \
97-
-H "Authorization: Bearer <api-key>"
98-
```
99-
100-
Returns a temporary download link (valid for 5 minutes, no auth needed):
101-
102-
```json
103-
{"url": "http://localhost:8000/files/download/a1b2c3d4..."}
104-
```
105-
10649
## API Docs
10750

108-
Interactive API documentation is available at [http://localhost:8000/docs](http://localhost:8000/docs).
51+
Full interactive API documentation is available at [http://localhost:8000/docs](http://localhost:8000/docs).
10952

11053
## License
11154

0 commit comments

Comments
 (0)