90 lines
2.5 KiB
Markdown
90 lines
2.5 KiB
Markdown
# Hygate
|
|
|
|
## About
|
|
|
|
Hygate is a standalone, single-binary gateway that exposes Tencent's Hunyuan 3 (hy3) Gradio space through an OpenAI-compatible API. It translates the standard `/v1/chat/completions` and `/v1/models` endpoints into Gradio's `/gradio_api/call/chat` request/stream protocol, so any OpenAI-compatible client can talk to Hunyuan 3 without modification.
|
|
|
|
## Features
|
|
|
|
- OpenAI-compatible chat completions (streaming and non-streaming)
|
|
- Reasoning content passthrough (`reasoning_content`)
|
|
- Tool/function calling, including incremental streaming of tool-call arguments
|
|
- Fibonacci backoff retry on upstream calls
|
|
- Configurable endpoint and User-Agent
|
|
- No external dependencies (standard library only)
|
|
|
|
## Installation
|
|
|
|
Build from source with Go 1.26 or newer:
|
|
|
|
```
|
|
make
|
|
```
|
|
|
|
This produces `bin/hygate` binary for your architecture.
|
|
|
|
Install the latest release straight from the Git repository with `go install`:
|
|
|
|
```
|
|
go install code.luxferre.top/luxferre/hygate@latest
|
|
```
|
|
|
|
This fetches the module from `https://code.luxferre.top/luxferre/hygate.git` and places the `hygate` binary in `$(go env GOPATH)/bin`. Make sure that directory is on your `PATH`.
|
|
|
|
If you prefer to build from a local checkout instead:
|
|
|
|
```
|
|
git clone https://code.luxferre.top/luxferre/hygate.git
|
|
cd hygate
|
|
go install .
|
|
```
|
|
|
|
## Usage
|
|
|
|
Run the gateway:
|
|
|
|
```
|
|
./bin/hygate [-port 8080] [-endpoint https://tencent-hy3.hf.space]
|
|
```
|
|
|
|
Available flags:
|
|
|
|
- `-port` — TCP port to listen on (default `8080`)
|
|
- `-endpoint` — root URL of the Hunyuan Gradio space (default `https://tencent-hy3.hf.space`)
|
|
- `-user-agent` / `-ua` — custom User-Agent sent to the upstream
|
|
|
|
Endpoints served:
|
|
|
|
- `GET /v1/models`
|
|
- `POST /v1/chat/completions`
|
|
|
|
Example request with curl:
|
|
|
|
```
|
|
curl http://localhost:8080/v1/chat/completions \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"model":"hy3","messages":[{"role":"user","content":"Hello"}],"stream":false}'
|
|
```
|
|
|
|
## FAQ
|
|
|
|
### Does this need an API key?
|
|
|
|
No. The gateway proxies directly to the public Gradio space and does not require authentication.
|
|
|
|
### Which models are reported?
|
|
|
|
A single model, `hy3`, is advertised via `/v1/models`.
|
|
|
|
### Are token usage counts returned?
|
|
|
|
No. The `usage` field is always zero, since the upstream Gradio API does not expose token counts.
|
|
|
|
### Can the upstream endpoint be changed?
|
|
|
|
Yes, with the `-endpoint` flag. Any HuggingFace Gradio space hosting the compatible `chat` endpoint will work.
|
|
|
|
## Credits
|
|
|
|
Created by Luxferre in 2026, released into the public domain with no warranties.
|