diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..77e8922 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release + +# Triggered when a version tag is pushed, e.g. `git tag v0.1.0 && git push --tags`. +# Publishes the crate to crates.io and creates a GitHub Release with prebuilt binaries. +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + # --- publish to crates.io ------------------------------------------------- + crates-io: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Publish to crates.io + # Requires a CARGO_REGISTRY_TOKEN repo secret (Settings → Secrets → Actions). + if: ${{ secrets.CARGO_REGISTRY_TOKEN != '' }} + run: cargo publish --token "${{ secrets.CARGO_REGISTRY_TOKEN }}" + + # --- prebuilt binaries + GitHub Release ----------------------------------- + release: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: macos-14 + target: aarch64-apple-darwin + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 + - name: Build + run: cargo build --release --target ${{ matrix.target }} + - name: Package + shell: bash + run: | + staging="cortiq-gateway-${{ github.ref_name }}-${{ matrix.target }}" + mkdir "$staging" + cp "target/${{ matrix.target }}/release/cortiq-gateway" "$staging"/ + cp README.md LICENSE config/gateway.example.toml "$staging"/ + tar czf "$staging.tar.gz" "$staging" + echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV" + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: ${{ env.ASSET }} + generate_release_notes: true diff --git a/CHANGELOG.md b/CHANGELOG.md index ad6d53f..847ef30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/). -## [Unreleased] +## [0.1.0] - 2026-06-30 ### Added - **Embedded admin web console** at `/admin` — a build-free single-page app compiled diff --git a/Cargo.lock b/Cargo.lock index 7be3006..4cbb0bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -263,7 +263,7 @@ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "cortiq-gateway" -version = "0.0.1" +version = "0.1.0" dependencies = [ "anyhow", "arc-swap", diff --git a/Cargo.toml b/Cargo.toml index 3a11152..a3edc98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,26 @@ [package] name = "cortiq-gateway" -version = "0.0.1" +version = "0.1.0" edition = "2021" +rust-version = "1.75" license = "Apache-2.0" -description = "Universal LLM gateway with intelligent routing via cortiq-router" +description = "Universal LLM gateway with intelligent routing and an embedded multilingual admin console" repository = "https://github.com/infosave2007/cortiq-gateway" +homepage = "https://api.allaigate.com" readme = "README.md" keywords = ["llm", "gateway", "proxy", "openai", "routing"] -categories = ["web-programming::http-server"] +categories = ["web-programming::http-server", "command-line-utilities"] +# Files shipped in the published crate. The embedded admin SPA (web/) MUST be +# included because rust-embed compiles it in; docs/screenshots are excluded to +# keep the crate lean. +include = [ + "src/**/*", + "web/**/*", + "config/gateway.example.toml", + "README.md", + "CHANGELOG.md", + "LICENSE", +] [dependencies] # async runtime + HTTP server diff --git a/README.md b/README.md index 6c7ac82..8e88412 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # Cortiq Gateway -**English** · [Русский](README.ru.md) +**English** · [Русский](https://github.com/infosave2007/cortiq-gateway/blob/master/README.ru.md) -[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) +[![Crates.io](https://img.shields.io/crates/v/cortiq-gateway.svg)](https://crates.io/crates/cortiq-gateway) +[![CI](https://github.com/infosave2007/cortiq-gateway/actions/workflows/ci.yml/badge.svg)](https://github.com/infosave2007/cortiq-gateway/actions/workflows/ci.yml) +[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/infosave2007/cortiq-gateway/blob/master/LICENSE) ![Rust](https://img.shields.io/badge/Rust-2021-orange.svg) -![Status](https://img.shields.io/badge/status-active-success.svg) **A universal LLM gateway with intelligent routing.** One OpenAI-compatible endpoint → automatic model selection from your pool @@ -44,18 +45,35 @@ One OpenAI-compatible endpoint → automatic model selection from your pool --- +## 📦 Install + +```bash +# from crates.io +cargo install cortiq-gateway + +# or build from source +git clone https://github.com/infosave2007/cortiq-gateway +cd cortiq-gateway +cargo build --release # ./target/release/cortiq-gateway +``` + +--- + ## 🖥️ Admin console -![Dashboard](docs/screenshots/dashboard.png) +![Dashboard](https://raw.githubusercontent.com/infosave2007/cortiq-gateway/master/docs/screenshots/dashboard.png) The gateway ships with an embedded web console at **`/admin`**: -| | | +| Models | Routing | |---|---| -| ![Models](docs/screenshots/models.png) | ![Routing](docs/screenshots/routing.png) | -| **Models** — add/edit/probe models, manage provider keys | **Routing** — visual tier editor (ordered, drag-to-reorder) | -| ![Playground](docs/screenshots/playground.png) | ![Dashboard](docs/screenshots/dashboard.png) | -| **Playground** — test the live pipeline, see the decision | **Dashboard** — traffic, cost, latency analytics | +| ![Models](https://raw.githubusercontent.com/infosave2007/cortiq-gateway/master/docs/screenshots/models.png) | ![Routing](https://raw.githubusercontent.com/infosave2007/cortiq-gateway/master/docs/screenshots/routing.png) | +| add/edit/probe models, manage provider keys | visual tier editor (ordered, reorderable) | + +| Playground | +|---| +| ![Playground](https://raw.githubusercontent.com/infosave2007/cortiq-gateway/master/docs/screenshots/playground.png) | +| test the live pipeline and see the routing decision | ```bash cargo run --release -- --config config/gateway.toml --admin-token @@ -79,7 +97,7 @@ cp config/gateway.example.toml config/gateway.toml $EDITOR config/gateway.toml # 3. run the gateway -cargo run --release -- --config config/gateway.toml +cortiq-gateway --config config/gateway.toml # Gateway listens on 0.0.0.0:9000 and serves the admin console at /admin ``` @@ -113,13 +131,13 @@ print(resp.choices[0].message.content) ## Request flow 1. Client → `POST /v1/chat/completions` (or Anthropic/MCP) with `model: "cortiq-auto"`. -2. The gateway extracts the **text to route on** (strategy is configurable, see [docs/ROUTING.md](docs/ROUTING.md)). +2. The gateway extracts the **text to route on** (strategy is configurable, see [docs/ROUTING.md](https://github.com/infosave2007/cortiq-gateway/blob/master/docs/ROUTING.md)). 3. Gateway → `cortiq-router /v1/route` → gets `task_label` + `complexity.tier`. 4. Gateway selects a model from the pool via the routing table (with a fallback order). 5. Gateway → the selected model's provider (translating the protocol if needed), returns the response. 6. Gateway attaches routing metadata in headers/`usage` and records cost & statistics. -Details — [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). +Details — [docs/ARCHITECTURE.md](https://github.com/infosave2007/cortiq-gateway/blob/master/docs/ARCHITECTURE.md). --- @@ -181,8 +199,8 @@ high = ["claude-opus", "local-qwen"] default = "local-qwen" ``` -Full example — [config/gateway.example.toml](config/gateway.example.toml). -Routing & cost-aware selection — [docs/ROUTING.md](docs/ROUTING.md). +Full example — [config/gateway.example.toml](https://github.com/infosave2007/cortiq-gateway/blob/master/config/gateway.example.toml). +Routing & cost-aware selection — [docs/ROUTING.md](https://github.com/infosave2007/cortiq-gateway/blob/master/docs/ROUTING.md). Everything in the config is also editable from the admin console at runtime. --- @@ -195,7 +213,7 @@ Everything in the config is also editable from the admin console at runtime. - **Cost accounting:** token usage + USD cost and the selected model. - **Observability:** `GET /metrics` (Prometheus), `GET /healthz`, `GET /readyz`. -Details — [docs/PROTOCOLS.md](docs/PROTOCOLS.md). +Details — [docs/PROTOCOLS.md](https://github.com/infosave2007/cortiq-gateway/blob/master/docs/PROTOCOLS.md). --- @@ -214,9 +232,9 @@ cargo test # config round-trip, routing validation degradation, cost/token accounting, the **embedded multilingual admin console with hot config reload**, statistics and Prometheus `GET /metrics`. Planned: streaming (SSE), Anthropic provider/inbound, embeddings, MCP. See the roadmap in -[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). Contributions welcome — see -[CONTRIBUTING.md](CONTRIBUTING.md). +[docs/ARCHITECTURE.md](https://github.com/infosave2007/cortiq-gateway/blob/master/docs/ARCHITECTURE.md). +Contributions welcome — see [CONTRIBUTING.md](https://github.com/infosave2007/cortiq-gateway/blob/master/CONTRIBUTING.md). ## License -Apache-2.0 — see [LICENSE](LICENSE). +Apache-2.0 — see [LICENSE](https://github.com/infosave2007/cortiq-gateway/blob/master/LICENSE).