Open-source SDK & CLI

Python, TypeScript and a one-liner CLI. MIT-licensed. Use HiWay without touching the dashboard.

HiWay ships open-source client tooling. Three surfaces, same backend: the CLI for fast terminal workflows, the Python SDK for scripts and notebooks, and the TypeScript SDK for web and Node apps. All MIT-licensed, all on GitHub under the Hiway2llm/client repository.

Why this matters

Most routing proxies (OpenRouter, Portkey, Helicone) ship closed-source integrations. HiWay publishes the CLI, SDKs, installer scripts, examples and a reproducible benchmark harness — so you can audit exactly what hits the network, self-host the CLI in air-gapped CI, and run our benchmarks against your own workload before committing.

CLI — 30-second install

The CLI handles signup, prompt execution, quota monitoring and benchmarks — straight from your terminal, no dashboard required.

bash
# Install (macOS, Linux, Windows via Git Bash / WSL)
curl -fsSL https://install.hiway2llm.com | sh

# Create a free account (opens your browser, OAuth-style device flow)
hw signup

# Run a prompt
hw run "explain quantum entanglement in 3 bullets"

# Check your quota
hw status

CLI commands

CommandDescription
hw signupCreate a free account via device flow. No credit card.
hw loginSave an existing hw_live_ key to ~/.hiway2llm/config.json.
hw run "..."One-shot prompt, prints the answer and the routed model.
hw chatInteractive REPL.
hw statusRemaining monthly requests + cumulative savings vs flagship baseline.
hw modelsList models available through your enabled providers.
hw benchmarkRun the reproducible benchmark harness against your own workload.
hw upgradeOpen the pricing page in your browser.

Python SDK

bash
pip install hiway2llm
app.py
from hiway2llm import Hiway

client = Hiway(api_key="hw_live_YOUR_KEY")  # reads HIWAY_API_KEY if omitted

response = client.chat(
    model="auto",
    messages=[{"role": "user", "content": "Summarize relativity in 3 bullets"}],
)

print(response.content)
print("Routed to:", response.routed_model, "/", response.routed_tier)

The Python SDK is a thin wrapper around the OpenAI-compatible endpoint — if you already use openai, you can just override base_url instead of installing hiway2llm. The native SDK adds typed access to the _hiway metadata, built-in retry on provider fallback, and a streaming iterator with token-by-token usage accounting.

TypeScript SDK

bash
npm install @hiway2llm/client
hiway.ts
import { Hiway } from "@hiway2llm/client";

const client = new Hiway({ apiKey: process.env.HIWAY_API_KEY! });

const response = await client.chat({
  model: "auto",
  messages: [{ role: "user", content: "Write a limerick about HTTP" }],
});

console.log(response.content);
console.log("Routed to:", response.routedModel, "/", response.routedTier);

Works in Node 20+, Bun, Deno, Cloudflare Workers, and the browser (with a proxy for the Authorization header — never ship a hw_live_ key to the client-side).

Prefer your existing SDK?

You don't need any HiWay SDK to use HiWay. The endpoint is fully OpenAI-compatible, so keep your existing openai / @ai-sdk/openai / LangChain client and override base_url to https://app.hiway2llm.com/v1. See the Integrations section for copy-paste snippets.

Source code & contributions

  • Repo: [github.com/Hiway2llm/client](https://github.com/Hiway2llm/client)
  • License: MIT — all client tooling
  • The router backend (smart routing, semantic cache, billing) is proprietary and not part of this repo
  • Issues and PRs welcome. The benchmark harness in benchmarks/ is the best place to reproduce and report edge cases.