---
name: kourier-setup
description: Configure a coding agent (Oh My Pi, Claude Code, Codex CLI, or any OpenAI-compatible client) to use Kourier's flat-rate DeepSeek V4.1 Flash API.
---

# Set up Kourier as a model provider

Kourier (https://kourier.sh) serves DeepSeek V4.1 Flash behind OpenAI-compatible and Anthropic-compatible endpoints on a flat monthly plan. Plans limit concurrent requests (Starter 1, Pro 3), never tokens.

## Facts

- OpenAI-compatible base URL: https://api.kourier.sh/v1
- Anthropic-compatible base URL: https://api.kourier.sh/anthropic
- Auth: `Authorization: Bearer <key>` (the Anthropic surface also accepts `x-api-key`)
- Model id: `deepseek-v4.1-flash` (exact string; aliases are rejected)
- Context: 262,144 tokens total for prompt plus output combined; up to 16,384 tokens per response
- Keys: sign up at https://app.kourier.sh/signup, choose Starter or Pro in Billing, then Dashboard → API Keys

Ask the user for their key, or read it from `KOURIER_API_KEY`. Never write the key into a repository.

## Oh My Pi (omp)

Add to `~/.omp/agent/models.yml`:

```yaml
providers:
  kourier:
    baseUrl: https://api.kourier.sh/v1
    api: openai-completions
    apiKey: KOURIER_API_KEY
    authHeader: true
    models:
      - id: deepseek-v4.1-flash
        name: DeepSeek V4.1 Flash (Kourier)
        reasoning: true
        input: [text]
        contextWindow: 262144
        maxTokens: 16384
        cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
```

Run `omp --model kourier/deepseek-v4.1-flash`, or set `modelRoles.default: kourier/deepseek-v4.1-flash` in `~/.omp/agent/config.yml`.

## Claude Code

```bash
export ANTHROPIC_BASE_URL="https://api.kourier.sh/anthropic"
export ANTHROPIC_AUTH_TOKEN="$KOURIER_API_KEY"
export ANTHROPIC_MODEL="deepseek-v4.1-flash"
export ANTHROPIC_SMALL_FAST_MODEL="deepseek-v4.1-flash"
```

`ANTHROPIC_SMALL_FAST_MODEL` is required; without it background calls go to an ungranted Haiku model and fail.

## Codex CLI

Add to `~/.codex/config.toml` (Codex needs the Responses wire format, which Kourier serves):

```toml
[model_providers.kourier]
name = "Kourier"
base_url = "https://api.kourier.sh/v1"
env_key = "KOURIER_API_KEY"
wire_api = "responses"

[profiles.kourier]
model_provider = "kourier"
model = "deepseek-v4.1-flash"
```

Run `codex --profile kourier`.

## Any other OpenAI-compatible client

Set base URL `https://api.kourier.sh/v1`, the API key, and model `deepseek-v4.1-flash`.

## Verify

```bash
curl https://api.kourier.sh/v1/chat/completions \
  -H "Authorization: Bearer $KOURIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"Reply with ok"}]}'
```

## Errors

- 401: key missing or wrong.
- 429 with Retry-After: the plan's concurrency limit is reached; wait, or run fewer parallel subagents.

Full docs: https://docs.kourier.sh/docs
