11# embedrock 🪨
22
3- OpenAI-compatible Bedrock embedding proxy for OpenClaw and Friends . Drop-in replacement for any tool expecting ` /v1/embeddings ` .
3+ OpenAI-compatible embedding proxy for Amazon Bedrock . Drop-in replacement for any tool expecting ` /v1/embeddings ` .
44
55## Why?
66
@@ -20,6 +20,8 @@ Zero API keys needed — uses your AWS credentials (instance profile, env vars,
2020
2121Model family is auto-detected by ID prefix. Titan and Cohere use different Bedrock request/response formats — embedrock handles this transparently.
2222
23+ > ** Single-model design:** Each embedrock process serves one model. If a request specifies a different model, it returns HTTP 400 with a clear error. Run multiple instances for multiple models.
24+
2325## Install
2426
2527** From releases:**
@@ -32,6 +34,14 @@ chmod +x /usr/local/bin/embedrock
3234# Linux amd64
3335curl -fsSL https://github.com/inceptionstack/embedrock/releases/latest/download/embedrock-linux-amd64 -o /usr/local/bin/embedrock
3436chmod +x /usr/local/bin/embedrock
37+
38+ # macOS arm64 (Apple Silicon)
39+ curl -fsSL https://github.com/inceptionstack/embedrock/releases/latest/download/embedrock-darwin-arm64 -o /usr/local/bin/embedrock
40+ chmod +x /usr/local/bin/embedrock
41+
42+ # macOS amd64
43+ curl -fsSL https://github.com/inceptionstack/embedrock/releases/latest/download/embedrock-darwin-amd64 -o /usr/local/bin/embedrock
44+ chmod +x /usr/local/bin/embedrock
3545```
3646
3747** From source:**
@@ -52,10 +62,75 @@ embedrock --model cohere.embed-v4:0
5262# Custom config
5363embedrock --port 9090 --region eu-west-1 --model cohere.embed-english-v3
5464
55- # Flags
65+ # Show version
66+ embedrock --version
67+
68+ # All flags
5669embedrock --help
5770```
5871
72+ ### CLI Reference
73+
74+ | Flag | Default | Description |
75+ | ------| ---------| -------------|
76+ | ` --port ` | ` 8089 ` | Port to listen on |
77+ | ` --host ` | ` 127.0.0.1 ` | Host to bind to |
78+ | ` --region ` | ` us-east-1 ` | AWS region for Bedrock |
79+ | ` --model ` | ` amazon.titan-embed-text-v2:0 ` | Bedrock embedding model ID |
80+ | ` --version ` | | Show version and exit |
81+
82+ ### Subcommands
83+
84+ | Command | Description |
85+ | ---------| -------------|
86+ | ` embedrock update ` | Self-update to the latest release from GitHub |
87+ | ` sudo embedrock install-daemon ` | Install as a systemd service |
88+
89+ ## Self-Update
90+
91+ embedrock can update itself in place:
92+
93+ ``` bash
94+ embedrock update
95+ ```
96+
97+ This will:
98+ 1 . Check GitHub for the latest release
99+ 2 . Download the correct binary for your OS/architecture
100+ 3 . Verify the SHA-256 checksum
101+ 4 . Replace the current binary atomically
102+ 5 . Restart the systemd service if running as one (requires root)
103+
104+ If running as a non-root user with a systemd service:
105+ ```
106+ Updated embedrock from v0.3.0 to v0.4.0
107+ Restart embedrock.service manually (requires sudo)
108+ ```
109+
110+ ## Install as Daemon
111+
112+ Install embedrock as a systemd service with one command:
113+
114+ ``` bash
115+ # Install with defaults (port 8089, us-east-1, Titan v2)
116+ sudo embedrock install-daemon
117+
118+ # Install with custom settings
119+ sudo embedrock --port 9090 --region eu-west-1 --model cohere.embed-v4:0 install-daemon
120+ ```
121+
122+ This will:
123+ 1 . Copy the binary to ` /usr/local/bin/embedrock `
124+ 2 . Write a systemd unit file to ` /etc/systemd/system/embedrock.service `
125+ 3 . Run ` systemctl daemon-reload ` , ` enable ` , and ` start `
126+
127+ The CLI flags you pass (` --port ` , ` --region ` , ` --model ` ) are baked into the service's ` ExecStart ` command.
128+
129+ To check service status:
130+ ``` bash
131+ systemctl status embedrock
132+ ```
133+
59134## API
60135
61136** Health check:**
@@ -81,30 +156,39 @@ curl -X POST http://127.0.0.1:8089/v1/embeddings \
81156 -d ' {"input": ["First text", "Second text"], "model": "amazon.titan-embed-text-v2:0"}'
82157```
83158
84- ## Run as a Service
159+ ** Response format: **
85160
86- ``` bash
87- sudo tee /etc/systemd/system/embedrock.service > /dev/null << 'EOF '
88- [Unit]
89- Description=embedrock - Bedrock embedding proxy
90- After=network.target
91-
92- [Service]
93- Type=simple
94- User=ec2-user
95- ExecStart=/usr/local/bin/embedrock --port 8089 --region us-east-1 --model cohere.embed-v4:0
96- Restart=always
97- RestartSec=5
98-
99- [Install]
100- WantedBy=multi-user.target
101- EOF
102-
103- sudo systemctl daemon-reload
104- sudo systemctl enable embedrock
105- sudo systemctl start embedrock
161+ ``` json
162+ {
163+ "object" : " list" ,
164+ "data" : [
165+ {
166+ "object" : " embedding" ,
167+ "index" : 0 ,
168+ "embedding" : [0.123 , -0.456 , ... ]
169+ }
170+ ],
171+ "model" : " amazon.titan-embed-text-v2:0" ,
172+ "usage" : {
173+ "prompt_tokens" : 3 ,
174+ "total_tokens" : 3
175+ }
176+ }
177+ ```
178+
179+ ** Error responses:**
180+
181+ ``` json
182+ {
183+ "error" : {
184+ "message" : " model 'cohere.embed-v4:0' is not available; this server is configured with 'amazon.titan-embed-text-v2:0'" ,
185+ "type" : " invalid_request"
186+ }
187+ }
106188```
107189
190+ Internal errors return a generic ` "embedding failed" ` message — no AWS internals are leaked to clients.
191+
108192## OpenClaw Configuration
109193
110194``` json
@@ -130,19 +214,25 @@ sudo systemctl start embedrock
130214## Development
131215
132216``` bash
217+ # Install dependencies
218+ go mod download
219+
133220# Run tests
134- go test ./... -v
221+ go test ./... -v -count=1
135222
136223# Build
137224go build ./cmd/embedrock/
138225
139226# Build with version info
140- go build -ldflags " -X main.version=v0.2.0" ./cmd/embedrock/
227+ go build -ldflags " -X main.version=v0.4.0 -X main.commit=$( git rev-parse --short HEAD) -X main.date=$( date -u +%Y-%m-%dT%H:%M:%SZ) " ./cmd/embedrock/
228+
229+ # Lint (requires golangci-lint)
230+ golangci-lint run ./...
141231```
142232
143233## Architecture
144234
145- See [ ARCHITECTURE.md] ( ARCHITECTURE.md ) for design details.
235+ See [ ARCHITECTURE.md] ( ARCHITECTURE.md ) for design details and [ AGENTS.md ] ( AGENTS.md ) for AI coding agent guidelines .
146236
147237## License
148238
0 commit comments