# AIRelay

AIRelay is a local OpenAI-compatible HTTP server backed by a ChatGPT subscription login that AIRelay stores independently. It protects `/v1/*` and `/no-tools/v1/*` with its own relay bearer token, logs every transit to JSONL, and exposes only the routes that were verified against the subscription backend.

## Key Docs

- [README.md](README.md)
  - project overview, install paths, quick start, supported routes, and security defaults
- [docs/getting-started.md](docs/getting-started.md)
  - install options plus first-run workflow with `airelay init`, `airelay login`, `airelay serve`, and status smoke tests
- [docs/configuration.md](docs/configuration.md)
  - config file, environment overrides, and path conventions
- [docs/security.md](docs/security.md)
  - bearer-token protection, rate limits, protected diagnostics, upload ceilings, and logging
- [docs/api.md](docs/api.md)
  - supported and unsupported route details
- [docs/architecture.md](docs/architecture.md)
  - package boundaries, request flow, and intentional design limits
- [docs/subscription-status.md](docs/subscription-status.md)
  - normalized `GET /v1/subscription/status` payload
- [docs/faq.md](docs/faq.md)
  - common usage and policy questions
- [DISCLAIMER.md](DISCLAIMER.md)
  - independence, non-endorsement, and intended single-user local use
- [docs/troubleshooting.md](docs/troubleshooting.md)
  - bearer-token, upstream-auth, and rate-limit recovery guidance
- [docs/adr/README.md](docs/adr/README.md)
  - durable design decisions

## Important Paths

- config: `~/.config/airelay/config.toml`
- data dir: `~/.airelay`
- upstream auth fallback file: `~/.airelay/auth.json`
- relay token: `~/.airelay/relay-token`
- logs: `~/.airelay/logs`
- server token override: `AIRELAY_BEARER_TOKEN` or `--bearer-token-file`

## Main Commands

- `airelay init`
- `airelay status`
- `airelay init --json`, `airelay status --json`, `airelay logout --json`, `airelay token show --json`, and `airelay token rotate --json` keep machine-readable output available for automation
- `airelay login`
- `airelay serve`
- `airelay token show`
- `airelay token rotate`
- `GET /healthz` is public and minimal
- `GET /v1/relay/status` is protected and detailed
