02

Writings · tutorial

Using aipass-proxy with opencode

This guide covers how to run aipass-proxy locally and connect it to opencode as a custom provider, plus a few ideas for what to do with it.

Published
Read
2m
Contents

I built aipass-proxy to expose AIPass through the standard OpenAI /v1/chat/completions and /v1/models endpoints. This guide covers how to run it and connect it to opencode, an open-source coding agent that can use any OpenAI-compatible provider.

Important Warning

If you use this proxy, you connect to AIPass's API outside its official interface. AIPass's terms of service prohibit this. Using the proxy can violate those terms and risk suspension of your AIPass account. Read the terms yourself before you use this project.

Install

curl -sL https://raw.githubusercontent.com/pyyupsk/aipass-proxy/main/install.sh | bash

This script detects your operating system and architecture. It then installs the latest binary to ~/.local/bin. You do not need Bun, Node.js, or a clone of the repository.

Set Up Your Session Token

aipass-proxy setup

This command asks for two values. The first value is your AIPass session token. Find it in the __Secure-ai_passport_auth.session_token cookie, from an authenticated browser session at de.aipass.net. Open DevTools, go to Application or Storage, then Cookies, to find it. The second value is a port. Leave it blank to use the default port, 47871.

The setup command writes both values to ~/.config/aipass-proxy/.env. It locks the file so only you can read it.

Run the Proxy

aipass-proxy start

This command runs the proxy in the foreground, on http://localhost:47871 by default.

For a proxy that stays running, install it as a background service instead:

aipass-proxy install-service

This command generates a systemd user unit on Linux, or a launchd agent on macOS. It prints the exact command to enable the service. Once enabled, the proxy starts on login and restarts on its own after a crash.

Connect opencode

opencode reads a provider block from opencode.json. Add an entry that points at your local proxy:

{
  "$schema": "https://opencode.ai/config.json",
  "enabled_providers": ["opencode", "ollama-cloud", "aipass"],
  "provider": {
    "aipass": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "AIPass",
      "options": {
        "baseURL": "http://localhost:47871/v1",
        "apiKey": "unused"
      },
      "models": {
        "gemini-3.1-flash-lite": { "name": "Gemini 3.1 Flash Lite (Unlimited)" },
        "claude-opus-5@azure": { "name": "Claude Opus 5" },
        "gpt-5.6-terra": { "name": "GPT-5.6 Terra" },
        "DeepSeek-V3.2": { "name": "DeepSeek V3.2" },
        "grok-4.3": { "name": "Grok 4.3" }
      }
    }
  }
}

The apiKey field needs a value, but the proxy ignores it. Your real session token already lives in ~/.config/aipass-proxy/.env. Each key under models must match a model ID from AIPass. Each name is only the label opencode shows you.

Restart opencode after you save the config. You can then pick any of these models the same way you pick a normal opencode provider.

Verify It Works

curl http://localhost:47871/v1/models

curl http://localhost:47871/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gemini-3.1-flash-lite","messages":[{"role":"user","content":"hello"}]}'

The first command lists every model your session can access. The second command sends one test message through the proxy.

Ideas for What to Do With It

AIPass bundles a wide range of models behind one login. This setup gives opencode that same range, without extra accounts or extra API keys.

  • Route quick, low-stakes edits to an unlimited model, such as Gemini 3.1 Flash Lite. Save your paid quota for harder tasks.
  • Switch to a stronger model, such as Claude Opus 5 or GPT-5.6 Terra, for planning work or a difficult refactor.
  • Try Thai-specific models, such as Pathumma ThaiLLM or OpenThaiGPT 2.0 Legal, for Thai-language content or legal text.
  • Compare answers from different providers, such as DeepSeek V3.2 and Grok 4.3, on the same prompt. They all sit behind the one proxy.
  • Run the proxy as a background service on a home server. Every machine on your network can then reach the same AIPass session through one proxy address.

Where to Find It

pyyupsk / aipass-proxy

GitHub