|
|
@@ -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
|
|
|
|
### 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`).
|
|
|
|
- **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.
|
|
|
|
- **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`).
|
|
|
|
- **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.
|
|
|
|
- **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.
|
|
|
|
- **Fibonacci Backoff Retry**: Resilient against network hiccups and transient timeouts.
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
## Architecture & upstream protocol
|
|
|
|
|
|
|
|
|
|
|
|
## Architecture & Upstream Protocol
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
+---------------------------+ OpenAI HTTP / SSE +------------------------+
|
|
|
|
+---------------------------+ 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.
|
|
|
|
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"`.
|
|
|
|
2. `POST /operators/execute` -> Dispatches the `@harpreetsahota/qwen38-max/qwen38_chat` operator with method `"ask"`.
|
|
|
|
3. Polling Loops:
|
|
|
|
3. Polling Loops:
|
|
|
|
- `get_thinking_chunk`: Extracts newly generated reasoning tokens in real-time.
|
|
|
|
- `get_thinking_chunk`: Extracts newly generated reasoning tokens in real-time.
|
|
|
|
- `get_stream_chunk`: Extracts newly generated message content tokens in real-time.
|
|
|
|
- `get_stream_chunk`: Extracts newly generated message content tokens in real-time.
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
## Build and Run
|
|
|
|
|
|
|
|
|
|
|
|
## Build & Run
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Build
|
|
|
|
### Build
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
@@ -59,7 +57,7 @@ Binary is output to `bin/qorona`.
|
|
|
|
./bin/qorona -port 8080
|
|
|
|
./bin/qorona -port 8080
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### CLI Flags
|
|
|
|
### CLI flags
|
|
|
|
|
|
|
|
|
|
|
|
| Flag | Default | Description |
|
|
|
|
| Flag | Default | Description |
|
|
|
|
|------|---------|-------------|
|
|
|
|
|------|---------|-------------|
|
|
|
@@ -71,16 +69,14 @@ Binary is output to `bin/qorona`.
|
|
|
|
| `-user-agent` / `-ua` | `""` | Custom User-Agent header |
|
|
|
|
| `-user-agent` / `-ua` | `""` | Custom User-Agent header |
|
|
|
|
| `-hf-token` | `""` | Optional Hugging Face token |
|
|
|
|
| `-hf-token` | `""` | Optional Hugging Face token |
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
## API usage examples
|
|
|
|
|
|
|
|
|
|
|
|
## API Usage Examples
|
|
|
|
### 1. List models
|
|
|
|
|
|
|
|
|
|
|
|
### 1. List Models
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
curl http://localhost:8080/v1/models
|
|
|
|
curl http://localhost:8080/v1/models
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 2. Non-Streaming Chat Completion
|
|
|
|
### 2. Non-streaming chat completion
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
curl -X POST http://localhost:8080/v1/chat/completions \
|
|
|
|
curl -X POST http://localhost:8080/v1/chat/completions \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-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
|
|
|
|
```bash
|
|
|
|
curl -N -X POST http://localhost:8080/v1/chat/completions \
|
|
|
|
curl -N -X POST http://localhost:8080/v1/chat/completions \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-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
|
|
|
|
```bash
|
|
|
|
curl -X POST http://localhost:8080/v1/chat/completions \
|
|
|
|
curl -X POST http://localhost:8080/v1/chat/completions \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-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
|
|
|
|
```python
|
|
|
|
from openai import OpenAI
|
|
|
|
from openai import OpenAI
|
|
|
|
|
|
|
|
|
|
|
@@ -164,8 +160,6 @@ for chunk in response:
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Testing
|
|
|
|
## Testing
|
|
|
|
|
|
|
|
|
|
|
|
Run unit tests:
|
|
|
|
Run unit tests:
|
|
|
@@ -178,8 +172,6 @@ Run end-to-end integration tests:
|
|
|
|
./xtest.sh 8080
|
|
|
|
./xtest.sh 8080
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
## Credits
|
|
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
Created by Luxferre in 2026, released into the public domain with no warranties.
|
|
|
|
|
|
|
|
|
|
|
|
Public Domain / Unlicense
|
|
|
|
|
|
|
|