This commit is contained in:
Luxferre
2026-08-27 14:19:52 +03:00
parent f60f7b0c49
commit b81dd38812
4 changed files with 21 additions and 96 deletions
+19 -27
View File
@@ -1,14 +1,16 @@
# qorona
# Qorona
Standalone, zero-dependency OpenAI-compatible proxy gateway in Go for the **Qwen 3.8 Max** model (`Qwen/Qwen3.8-Max`) hosted on Hugging Face Spaces (`harpreetsahota-qwen38-max-openlogo-demo.hf.space`).
Free, standalone, zero-dependency OpenAI-compatible proxy gateway in Go for the **Qwen 3.8 Max** model (`Qwen/Qwen3.8-Max`) hosted on Hugging Face Spaces.
## Overview
## About
`qorona` reverse-engineers the FiftyOne plugin backend operator interface of the Hugging Face space and transforms it into a standard, production-ready OpenAI API endpoint (`/v1/chat/completions` and `/v1/models`).
Qorona reverse-engineers the FiftyOne plugin backend operator interface of the Hugging Face space and transforms it into a standard, production-ready OpenAI API endpoint (`/v1/chat/completions` and `/v1/models`).
The name comes from Qwen + the default image of Corona Extra beer bottles that the target demo space passes to the model unless any other file is specified.
### Features
- **OpenAI Standard Compatibility**: Full drop-in replacement for OpenAI API clients (Curl, Python `openai`, LangChain, LiteLLM, Open-WebUI).
- **OpenAI Standard Compatibility**: Full drop-in replacement for OpenAI API clients (Curl, Python `openai`, LangChain, Open-WebUI).
- **Zero External Dependencies**: Pure standard library Go implementation (`net/http`, `encoding/json`, `crypto/rand`, `time`).
- **Fully Headless & Browserless**: No Chromium, Playwright, or X11 required. Runs directly on bare servers, containers, or embedded systems.
- **Live Streaming SSE & Reasoning**: Streams real-time tokens with separation of reasoning content (`delta.reasoning_content`) and message content (`delta.content`).
@@ -16,9 +18,7 @@ Standalone, zero-dependency OpenAI-compatible proxy gateway in Go for the **Qwen
- **Session Lifecycle Management**: Thread-safe automatic session creation (`/__session/start`), periodic background heartbeats (`/__session/heartbeat`), and auto-reconnect recovery.
- **Fibonacci Backoff Retry**: Resilient against network hiccups and transient timeouts.
---
## Architecture & Upstream Protocol
## Architecture & upstream protocol
```
+---------------------------+ OpenAI HTTP / SSE +------------------------+
@@ -36,16 +36,14 @@ Standalone, zero-dependency OpenAI-compatible proxy gateway in Go for the **Qwen
+------------------------+
```
### Upstream Flow:
### Upstream flow
1. `POST /__session/start` -> Allocates an ephemeral session token `X-FiftyOne-Session` and dataset clone.
2. `POST /operators/execute` -> Dispatches the `@harpreetsahota/qwen38-max/qwen38_chat` operator with method `"ask"`.
3. Polling Loops:
- `get_thinking_chunk`: Extracts newly generated reasoning tokens in real-time.
- `get_stream_chunk`: Extracts newly generated message content tokens in real-time.
---
## Build & Run
## Build and Run
### Build
```bash
@@ -59,7 +57,7 @@ Binary is output to `bin/qorona`.
./bin/qorona -port 8080
```
### CLI Flags
### CLI flags
| Flag | Default | Description |
|------|---------|-------------|
@@ -71,16 +69,14 @@ Binary is output to `bin/qorona`.
| `-user-agent` / `-ua` | `""` | Custom User-Agent header |
| `-hf-token` | `""` | Optional Hugging Face token |
---
## API usage examples
## API Usage Examples
### 1. List Models
### 1. List models
```bash
curl http://localhost:8080/v1/models
```
### 2. Non-Streaming Chat Completion
### 2. Non-streaming chat completion
```bash
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
@@ -94,7 +90,7 @@ curl -X POST http://localhost:8080/v1/chat/completions \
}'
```
### 3. Streaming Chat Completion with Reasoning
### 3. Streaming chat completion with reasoning
```bash
curl -N -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
@@ -109,7 +105,7 @@ curl -N -X POST http://localhost:8080/v1/chat/completions \
}'
```
### 4. Function / Tool Calling
### 4. Function / tool calling
```bash
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
@@ -138,7 +134,7 @@ curl -X POST http://localhost:8080/v1/chat/completions \
}'
```
### 5. Python OpenAI Client Example
### 5. Python OpenAI client example
```python
from openai import OpenAI
@@ -164,8 +160,6 @@ for chunk in response:
print()
```
---
## Testing
Run unit tests:
@@ -178,8 +172,6 @@ Run end-to-end integration tests:
./xtest.sh 8080
```
---
## Credits
## License
Public Domain / Unlicense
Created by Luxferre in 2026, released into the public domain with no warranties.