> ## Documentation Index
> Fetch the complete documentation index at: https://docs.link-token.farhr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Codex

> Use Codex through the link-token API

## Install

### Official download (macOS)

[https://openai.com/codex/](https://openai.com/codex/)

### CLI

```bash theme={null} theme={null}
npm install -g @openai/codex
```

## Environment / config

### Config files

1. Edit `~/.codex/config.toml`:

```toml theme={null} theme={null}
profile = "link-token"

[model_providers.link-token]
name = "link-token"
base_url = "https://link-token.cn/v1"
personality = "pragmatic"
wire_api = "responses"

[profiles.link-token]
model = "gpt-5.2"
model_provider = "link-token"
model_reasoning_effort = "high"
```

2. Edit `~/.codex/auth.json`:

```json theme={null} theme={null}
{
  "OPENAI_API_KEY": "link-token_API_KEY"
}
```

### CC-Switch

1. Open CC-Switch → add a provider.

<img src="https://mintcdn.com/linktoken/gqi3se8Hxx4jF5Uf/images/codex/1.png?fit=max&auto=format&n=gqi3se8Hxx4jF5Uf&q=85&s=67017b78ebd662f5bc7a6fafac4593c1" alt="Codex 1" width="2072" height="1374" data-path="public/cn/codex-1.png" data-path="images/codex/1.png" />

2. Pick **link-token** from presets.

<img src="https://mintcdn.com/linktoken/gqi3se8Hxx4jF5Uf/images/codex/2.png?fit=max&auto=format&n=gqi3se8Hxx4jF5Uf&q=85&s=1303fb72d7de5a5df13e856cb90921cb" alt="Codex 2" width="2072" height="1374" data-path="public/cn/codex-2.png" data-path="images/codex/2.png" />

3. Paste your API key → **Add**.

<img src="https://mintcdn.com/linktoken/gqi3se8Hxx4jF5Uf/images/codex/3.png?fit=max&auto=format&n=gqi3se8Hxx4jF5Uf&q=85&s=3c650c7a261c444e5ad6df8f881bf508" alt="Codex 3" width="2072" height="1374" data-path="public/cn/codex-3.png" data-path="images/codex/3.png" />

4. Select **link-token** on the home screen → **Enable**.

<img src="https://mintcdn.com/linktoken/gqi3se8Hxx4jF5Uf/images/codex/4.png?fit=max&auto=format&n=gqi3se8Hxx4jF5Uf&q=85&s=b13f23f0cffb18559c08478436148529" alt="Codex 4" width="2072" height="1374" data-path="public/cn/codex-4.png" data-path="images/codex/4.png" />

## Using Codex

### Terminal

1. `cd` to your project, run `codex`.

```bash theme={null} theme={null}
cd /path/to/your/project
codex
```

2. Set permissions as prompted.

<img src="https://mintcdn.com/linktoken/CmeMISf2O4oa9WLK/images/OpenAICodex/1.webp?fit=max&auto=format&n=CmeMISf2O4oa9WLK&q=85&s=d79e645625a07332eb9fa8e94e30b1ca" alt="Codex 5" width="1212" height="814" data-path="public/cn/codex-5.png" data-path="images/OpenAICodex/1.webp" />

3. Choose a model.

<img src="https://mintcdn.com/linktoken/CmeMISf2O4oa9WLK/images/OpenAICodex/2.webp?fit=max&auto=format&n=CmeMISf2O4oa9WLK&q=85&s=8dec34e4138e5cdb246cecb054744320" alt="Codex 6" width="1212" height="814" data-path="public/cn/codex-6.png" data-path="images/OpenAICodex/2.webp" />

4. Type a natural-language task—if you get a reply, setup works.

<img src="https://mintcdn.com/linktoken/CmeMISf2O4oa9WLK/images/OpenAICodex/3.webp?fit=max&auto=format&n=CmeMISf2O4oa9WLK&q=85&s=e3e257c707bb4ad83cb739530130fa79" alt="Codex 8" width="1212" height="814" data-path="public/cn/codex-8.png" data-path="images/OpenAICodex/3.webp" />

### Desktop app

1. Open Codex, pick a workspace folder.
2. Enter a task—if it responds, you’re good.

<img src="https://mintcdn.com/linktoken/CmeMISf2O4oa9WLK/images/OpenAICodex/4.webp?fit=max&auto=format&n=CmeMISf2O4oa9WLK&q=85&s=7c9c4364f631bd035b3d3e718de7a636" alt="Codex 9" width="2632" height="1712" data-path="public/cn/codex-9.png" data-path="images/OpenAICodex/4.webp" />

## CLI reference

### Help

```bash theme={null} theme={null}
codex -h
```

### Options (excerpt)

```bash theme={null} theme={null}
Usage
  $ codex [options] <prompt>

Options
  -h, --help                 Show help and exit
  -m, --model <model>        Model to use (default: codex-mini-latest)
  -i, --image <path>         Path to an image input file
  -v, --view <rollout>       Inspect a saved rollout
  -q, --quiet                Non-interactive: print only final assistant output
  -a, --approval-mode <mode>  Override approval: 'suggest', 'auto-edit', or 'full-auto'

  --auto-edit                Auto-approve file edits; still confirm shell commands
  --full-auto                Auto-approve edits and commands in the sandbox

  --no-project-doc           Do not auto-include repo `codex.md`
  --project-doc <file>       Include a specific Markdown file as context
  --full-stdout              Do not truncate command stdout/stderr

Dangerous
  --dangerously-auto-approve-everything
                             Skip all confirmations and run commands (no sandbox)
                             For temporary local testing only

Experimental
  -f, --full-context         “Full context” mode: load the whole repo and batch-edit
                             Requires --model

Examples
  $ codex "Write and run a Python program that prints ASCII art"
  $ codex -q "Fix the build"
```
