pan

Using pan

pan is the school's LLM gateway: one LearningHub login, a personal budget, and the models your role unlocks — in the chat, in your editor, and from your own code.

Chat

Open https://llm.42hn.dev and choose Login with LearningHub. Nothing to configure.

The tutor explains, asks questions and gives hints and pseudocode; it does not hand out finished solutions. Sprinters work with the tutor only, and API keys unlock at level 1. Everyone else can pick tutor whenever they would rather be guided than handed an answer — in the chat or with a key.

Get a key (level 1 and up)

Go to https://pan.42hn.dev, log in, and create your personal key. It is shown once — copy it straight into your shell profile or secret manager.

Claude Code

export ANTHROPIC_BASE_URL=https://ai.42hn.dev
export ANTHROPIC_AUTH_TOKEN=<personal key>
export ANTHROPIC_MODEL=sonnet-5.5
export ANTHROPIC_DEFAULT_SONNET_MODEL=sonnet-5.5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=haiku-4.5
export ANTHROPIC_DEFAULT_OPUS_MODEL=opus-5.5    # level 2 and up; otherwise set it to sonnet-5.5
claude

The gateway only knows its own model names (sonnet-5.5, haiku-4.5, opus-5.5 from level 2), so all four model variables matter: without the DEFAULT_* ones Claude Code asks for names the gateway rejects. A startup note that the model is unrecognized is harmless. The cost Claude Code prints is its own estimate; your real spend is in the portal.

Codex

Add a provider to ~/.codex/config.toml:

model = "gpt-5.6-terra"
model_provider = "pan"

[model_providers.pan]
name = "pan"
base_url = "https://ai.42hn.dev/v1"
env_key = "PAN_API_KEY"
wire_api = "responses"
export PAN_API_KEY=<personal key>
codex

OpenAI SDKs

export OPENAI_BASE_URL=https://ai.42hn.dev/v1
export OPENAI_API_KEY=<personal key>

Continue, Zed, Cursor

Add an OpenAI-compatible provider:

Setting Value
Provider openai
API base https://ai.42hn.dev/v1
API key your personal key
Model any id from the list below

To see the models your role may use:

curl https://ai.42hn.dev/v1/models -H "Authorization: Bearer <personal key>"

Your own project

Level 1 and up can create a second project key in the portal for code you deploy or share with teammates. It has a small cap of its own and draws from the same budget as everything else you do.

Budget

Your budget is in US dollars and has three rolling windows that all apply at once: 5 hours, 7 days and 30 days. Chat and keys count together. The portal shows what you have spent in each window, and https://pan.42hn.dev/me/usage breaks it down by day and model.

Every response carries your current state in a header:

X-Pan-Budget: 5h=1.20/4;7d=8.33/25;30d=19.10/50

When a window is full, requests fail with 429 budget_window_exceeded. The error names the window and resets_at, the time (Unix seconds) at which your oldest spend leaves that window and room frees up. Nothing resets all at once: budget comes back gradually, in the order you spent it.

Tips for making it last: use haiku-4.5 or gpt-5.6-luna for routine work, start a fresh conversation instead of dragging a long one along, and keep large files out of the context unless you need them.

Leaked a key?

Open the portal and press Rotate. The old key stops working immediately and you get a new one. Keys in a public repository will be found within minutes — rotate first, clean up second.

What not to paste

Prompts are sent to model providers through OpenRouter with zero-data-retention routing, and the gateway logs metadata only. See the privacy notice for the details.