# pi-j3gb-provider

[Pi](https://pi.dev) provider package for [vip.j3gb.com](https://vip.j3gb.com).

## Install

```bash
pi install npm:pi-j3gb-provider
/login j3gb                 # paste an sk-... J3GB API key
/model j3gb
```

For CI/non-interactive use:

```bash
export J3GB_API_KEY="sk-..."
pi
```

## Provider slots

| Provider | API adapter | Environment variable |
|---|---|---|
| `j3gb` | Native Anthropic Messages | `J3GB_API_KEY` |
| `j3gb-alt` | Native Anthropic Messages | `J3GB_ALT_API_KEY` |
| `j3gb-anthropic` | Native Anthropic Messages | `J3GB_ANTHROPIC_API_KEY` |
| `j3gb-openai` | OpenAI Chat Completions | `J3GB_OPENAI_API_KEY` |

`j3gb` and `j3gb-alt` are retained for compatibility. Use `/login <provider>` to store a key interactively.

## API wiring

J3GB supports both protocols:

```text
Anthropic
  Base URL: https://vip.j3gb.com
  Endpoint: POST /v1/messages
  Auth:     x-api-key: sk-...

OpenAI
  Base URL: https://vip.j3gb.com/v1
  Endpoint: POST /v1/chat/completions
  Auth:     Authorization: Bearer sk-...
```

J3GB key groups control server-side routing/capacity; they do not alter these client protocols. `/api/v1` is only the account/key-management API.

## Models and status

The extension refreshes the real model catalog at startup, after `/login`, and once after an error. Both API slots expose the same catalog; Grok is intentionally excluded.

A widget above the editor reports catalog refreshes and retains provider errors until that provider next succeeds. `No available accounts` and `All available accounts exhausted` are J3GB upstream-capacity errors, not extension failures.

## License

MIT
