Skip to content
GuidesAugust 5, 2026

Using AnyRouter from Linux, WSL, or a headless server

AnyRouter works from any machine that can make HTTPS requests — Linux servers, WSL, CI pipelines, and remote dev boxes. Here's the setup and the gotchas.

What you need

AnyRouter's API is just HTTPS. Any environment that can run curl or a Python/Node.js script can use it — no special client, no OS-specific binaries, no root access.

You need:

  • An AnyRouter account and API key (free to create at anyrouter.dev)
  • curl, Python, Node.js, or any HTTP client
  • Outbound HTTPS access to anyrouter.dev

Quick test from the terminal

Verify connectivity with a single curl command:

curl -s https://anyrouter.dev/api/v1/chat/completions \
  -H "Authorization: Bearer sk-ar-v1-placeholder" \
  -H "Content-Type: application/json" \
  -d '{"model":"anyrouter/free","messages":[{"role":"user","content":"Say hi"}]}'

If you get a JSON response with choices, you're connected. A 401 means the key is wrong; a network timeout means outbound HTTPS is blocked.

Common environment gotchas

  • HTTPS proxy — if you're behind a corporate proxy, set HTTPS_PROXY so curl and your SDK can reach anyrouter.dev.
  • Firewall rules — confirm outbound 443 is open on headless servers and CI runners.
  • TLS certificates — some minimal Docker images don't ship CA certs. Install ca-certificates if you see SSL errors.
  • Clock skew — if your server clock is off by more than a few minutes, TLS handshakes can fail. Sync with NTP.

Using from scripts and CI

Store your key as an environment variable. Don't hardcode it in scripts that go into version control:

export ANYROUTER_API_KEY="sk-ar-v1-..."
# Then in Python:
#   base_url="https://anyrouter.dev/api/v1"
# Or Node.js:
#   baseURL: "https://anyrouter.dev/api/v1"

CI platforms (GitHub Actions, GitLab CI, etc.) all support encrypted secrets — store the key there and reference it as an env var in your workflow.

AnyRouter status and reliability

For the current status of anyrouter.dev, check the system status page or try the health endpoint. If you're seeing intermittent failures, the fallover routing usually resolves them without code changes.

Track request-level health, latency, and error rates per model at chmonitor.dev.

Works from Linux, WSL, CI, or any HTTPS-capable environment. Sign up free.

Get started