Skip to content

Latest commit

 

History

History
107 lines (78 loc) · 3.62 KB

File metadata and controls

107 lines (78 loc) · 3.62 KB

OpenRouterCLIProxyAPI.jl

Dev Build Status

Unofficial OAuth session support for Claude, OpenAI, and Gemini models via CLIProxyAPI.

This package extends OpenRouter.jl to route requests through CLIProxyAPI, a local proxy that provides API endpoints using OAuth authentication from your existing subscriptions.

Installation

using Pkg
Pkg.add(url="https://github.com/sixzero/OpenRouterCLIProxyAPI.jl")

Prerequisites

  1. Install (or update) CLIProxyAPI:
    curl -fsSL https://raw.githubusercontent.com/brokechubb/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bash
    Re-run the same command to upgrade to the latest version (config is preserved). After upgrading, restart the service:
    systemctl --user restart cliproxyapi.service
  2. Authenticate with your provider(s):
    # OpenAI (Codex) — requires ChatGPT Pro/Plus subscription
    ~/cliproxyapi/cli-proxy-api -config ~/cliproxyapi/config.yaml -codex-login
    
    # Claude — requires Claude Pro/Max subscription
    ~/cliproxyapi/cli-proxy-api -config ~/cliproxyapi/config.yaml -claude-login
    
    # Gemini (Google)
    ~/cliproxyapi/cli-proxy-api -config ~/cliproxyapi/config.yaml -login
    
    # Qwen
    ~/cliproxyapi/cli-proxy-api -config ~/cliproxyapi/config.yaml -qwen-login
    
    # Add -no-browser to print the URL instead of opening a browser
    After authenticating, restart the service:
    systemctl --user restart cliproxyapi.service

Usage

using OpenRouter
using OpenRouterCLIProxyAPI

# One-time setup (registers provider + injects endpoints)
setup_cli_proxy!()

response = aigen("Hello!", "cli_proxy_api:anthropic/claude-opus-4.7")

Custom Configuration

setup_cli_proxy!(
    base_url = "http://localhost:8317/v1",
    api_key_env_var = "CLIPROXYAPI_API_KEY",
    provider_name = "cli_proxy_api",
    mutate = false  # true = overwrite existing endpoints
)

CLIProxyAPI Management

Check running version

~/cliproxyapi/cli-proxy-api --version 2>&1 | head -1

Update

# Re-run installer (preserves config, upgrades binary)
curl -fsSL https://raw.githubusercontent.com/brokechubb/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bash

# Then restart
systemctl --user restart cliproxyapi.service

Restart (e.g. after update, or if stale process running old binary)

systemctl --user restart cliproxyapi.service
systemctl --user status cliproxyapi.service

Note: Models are hardcoded in the binary — new models only appear after updating to a release that includes them. Models also only show if your logged-in account has access.

If a model isn't in the upstream release yet, see docs/CUSTOM_BINARY.md for how to build and deploy a patched binary.

Supported Models

Anthropic: claude-opus-4.7, claude-opus-4.6, claude-sonnet-4.6, claude-opus-4.5, claude-sonnet-4.5, claude-haiku-4.5, claude-opus-4.1, claude-sonnet-4

OpenAI: gpt-5.4, gpt-5.3-codex, gpt-5.3-codex-spark, gpt-5.2-codex, and older models

Related