20 releases (8 breaking)

Uses new Rust 2024

new 0.12.0 Feb 13, 2026
0.11.1 Jan 26, 2026
0.9.2 Nov 14, 2025
0.4.0 Jul 31, 2025

#323 in Machine learning

Download history 248/week @ 2025-10-25 164/week @ 2025-11-01 118/week @ 2025-11-08 295/week @ 2025-11-15 622/week @ 2025-11-22 200/week @ 2025-11-29 208/week @ 2025-12-06 325/week @ 2025-12-13 133/week @ 2025-12-20 9/week @ 2025-12-27 459/week @ 2026-01-03 360/week @ 2026-01-10 258/week @ 2026-01-17 387/week @ 2026-01-24 127/week @ 2026-01-31 210/week @ 2026-02-07

1,035 downloads per month
Used in 3 crates

MIT license

440KB
9K SLoC

Onwards

Crates.io Documentation GitHub

A Rust-based AI Gateway that provides a unified interface for routing requests to OpenAI-compatible targets. The goal is to be as "transparent" as possible.

Read the full documentation

Quickstart

Create a config.json:

{
  "targets": {
    "gpt-4": {
      "url": "https://api.openai.com",
      "onwards_key": "sk-your-openai-key",
      "onwards_model": "gpt-4"
    }
  }
}

Start the gateway:

cargo run -- -f config.json

Send a request:

curl -X POST http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Features

  • Unified routing to any OpenAI-compatible provider
  • Hot-reloading configuration with automatic file watching
  • Authentication with global and per-target API keys
  • Rate limiting and concurrency limiting (per-target and per-key)
  • Load balancing with weighted random and priority strategies
  • Automatic failover across multiple providers
  • Strict mode for request validation and error standardization
  • Response sanitization for OpenAI schema compliance
  • Prometheus metrics
  • Custom response headers

Documentation

Full documentation is available at doublewordai.github.io/onwards, covering:

Dependencies

~28–49MB
~690K SLoC