blackrouter
sign in create account

codex

through responses · /v1/responses · every model blackrouter serves, with its price and context window

model

deepseek-v4.1-flash · $0.30 in · $1.20 out /m · 128K context (not stated: 128K taken)

  1. a key

    create an account, then make an api key on it: it is shown once, so keep it.

    the provider below reads it from BLACKROUTER_API_KEY.

    macos, linux
    export BLACKROUTER_API_KEY=brk-…
    windows
    setx BLACKROUTER_API_KEY brk-… (then a new terminal)
  2. give codex a blackrouter profile

    ~/.codex/config.toml
    [model_providers.blackrouter]
    name = "blackrouter"
    base_url = "https://blackrouter.sh/v1"
    wire_api = "responses"
    env_key = "BLACKROUTER_API_KEY"
    stream_idle_timeout_ms = 600000
    ~/.codex/blackrouter.config.toml
    model_provider = "blackrouter"
    model = "deepseek-v4.1-flash"
    model_context_window = 131072
    web_search = "disabled"
    
    [features]
    multi_agent = false

    codex 0.134 or later · the provider goes after the rest of config.toml, so codex resume finds it; the profile is a file of its own · no codex plugin can set a provider

    compacts in time
    before 128K tokens: codex goes to 272K at most for a model it has no metadata for
    codex's own tools
    plain function tools; edits through apply_patch in its shell
    left out
    hosted web search and sub-agents, which blackrouter cannot run
  3. use it

    terminal
    codex -p blackrouter

    another model for one session: codex -p blackrouter -m deepseek-v4.1-flash · codex says it has no metadata for the model, and its /model lists openai's: both are expected

other ways

take [model_providers.blackrouter] out of config.toml and delete blackrouter.config.toml; sessions begun on blackrouter can't be resumed after