mirror of
https://github.com/fosrl/docs-v2.git
synced 2026-08-31 03:01:30 +02:00
62 lines
1.9 KiB
Plaintext
62 lines
1.9 KiB
Plaintext
---
|
|
title: "Codex"
|
|
description: "Connect Codex to a Pangolin AI Gateway resource"
|
|
---
|
|
|
|
|
|
|
|
Codex talks the OpenAI API, so the resource you point it at needs an OpenAI-compatible provider attached — OpenAI, OpenRouter, Vercel AI Gateway, Microsoft Foundry, or a custom OpenAI-compatible endpoint. See [AI Gateway Overview](/manage/ai/overview) if you haven't set that up yet.
|
|
|
|
import AiGatewayKey from "/snippets/ai-gateway-key.mdx";
|
|
|
|
You'll need the resource's URL (its `<endpoint>`) and its API key (`<key>`). Both are on the resource's Keys page.
|
|
|
|
<AiGatewayKey />
|
|
|
|
## Fastest: Pangolin CLI
|
|
|
|
[Install the Pangolin CLI](/manage/clients/install-client#quick-install-recommended) if you don't have it, then log in:
|
|
|
|
```bash
|
|
pangolin login
|
|
```
|
|
|
|
Configure Codex against a resource:
|
|
|
|
```bash
|
|
pangolin configure codex
|
|
```
|
|
|
|
This prompts you to pick an organization and resource if you have more than one, fetches a key for you if the resource needs one, and merges a `pangolin` provider into `~/.codex/config.toml` without touching anything else in that file. To skip the prompts:
|
|
|
|
```bash
|
|
pangolin configure codex --resource <resource-niceid-or-domain>
|
|
```
|
|
|
|
To undo it:
|
|
|
|
```bash
|
|
pangolin configure codex --reset
|
|
```
|
|
|
|
## Manual setup
|
|
|
|
Merge this into `~/.codex/config.toml` (honors `$CODEX_HOME` if you've set it):
|
|
|
|
```toml
|
|
model_provider = "pangolin"
|
|
|
|
[model_providers.pangolin]
|
|
name = "Pangolin AI Gateway"
|
|
base_url = "<endpoint>/v1"
|
|
wire_api = "responses"
|
|
env_key = "PANGOLIN_API_KEY"
|
|
```
|
|
|
|
Codex reads the key from the environment variable named in `env_key`, not from the file. Before running Codex, export it in your shell:
|
|
|
|
```bash
|
|
export PANGOLIN_API_KEY=<key>
|
|
```
|
|
|
|
Codex is the one client here that also tolerates no key at all: for a private resource you can drop the `env_key` line and skip the export entirely. Exporting `PANGOLIN_API_KEY=none` works too, so use whichever you find clearer. |