- OpenAI-compatible —
/v1/modelsand/v1/chat/completions - Streaming & non-streaming — automatic SSE forwarding and
/no-streamfallback - Built-in auth — optional
--keyAPI key protection - Proxy support — pass upstream HTTP/HTTPS proxy to
httpx - Encrypted credentials — local token stored safely under
./cred - Async powered — FastAPI +
httpx+uvloop
# 1. clone
git clone https://github.com/CuzTeam/hm-rev.git
cd hm-rev
# 2. install dependencies (requires uv)
uv sync
# 3. login via DevEco OAuth
uv run hm-api login
# 4. serve the OpenAI-compatible API
uv run hm-api serve --host 0.0.0.0 --port 8000 --key your-secret-keyIf you prefer not to open the browser automatically, use
uv run hm-api login --no-browserand follow the printed URL.
| Command | Description |
|---|---|
hm-api login [--proxy PROXY] [--no-browser] |
Authenticate with DevEco Code |
hm-api serve [--host HOST] [--port PORT] [--proxy PROXY] [--key KEY] |
Start the OpenAI-compatible proxy server |
hm-api status |
Show current login status |
| Option | Default | Description |
|---|---|---|
--host |
127.0.0.1 |
Bind host |
--port |
8000 |
Bind port |
--proxy |
— | Upstream HTTP/HTTPS proxy |
--key |
— | API key for client authentication (omit to disable) |
# list available models
curl http://localhost:8000/v1/models \
-H "Authorization: Bearer your-secret-key"
# chat completion (non-streaming)
curl http://localhost:8000/v1/chat/completions \
-H "Authorization: Bearer your-secret-key" \
-H "Content-Type: application/json" \
-d '{
"model": "GLM-5.1",
"messages": [{"role": "user", "content": "Hello!"}]
}'All authentication data is encrypted and stored locally under ./cred.
cred/ directory. It is already ignored by .gitignore.
hm-rev/
├── src/hm_api/ # CLI and server source code
│ ├── cli.py # Typer CLI entry
│ ├── server.py # FastAPI OpenAI-compatible proxy
│ ├── login.py # DevEco OAuth login flow
│ ├── crypto.py # Credential encryption
│ └── config.py # Constants and defaults
├── pyproject.toml # Project metadata and dependencies
├── uv.lock # Locked dependency tree
├── LICENSE # AGPL-3.0 + Non-Commercial clause
└── README.md # This file
You may use, modify, and distribute this software for non-commercial purposes only. Commercial use — including but not limited to selling, offering paid services, or incorporating it into commercial products — is strictly prohibited.
See LICENSE for full terms.
Made with 💜 by CuzTeam
and Thanks to the Linux.do community