Notice: Kling 4.0 is here: text-to-video and image-to-video are 20% off for a limited time. Try it now
HiAPI
Tutorials

API Key setup

Generate a config for Claude Code, Codex, OpenCode, or Hermes — or import it into CC Switch in one click.

Choose your AI tool

Use with
OS

Codex local configuration

DeepSeek V4 Flash Vision Exp · Command line · macOS

Import to CC Switch

Choose the tool, model, and API Key to import.

API Key

Loading…

The selected Key will be handed to your local CC Switch; confirm the import in the client before switching.

Responses API · https://api.hiapi.ai/v1

Didn't open? Install or update CC Switch and retry, or continue with manual setup.

Before you startCodex CLI 0.134+ · Command line mode: confirm the Codex CLI version in a terminal first.codex --versionInstallation guide ↗

1Save the configuration file

Create hiapi.config.toml in the .codex folder in your home directory, paste the configuration below, and save. Create the folder if needed.

Save to~/.codex/hiapi.config.toml

~ means your home directory; .codex is a hidden folder inside it.

Paste into the configuration file
model_provider = "hiapi"
model = "deepseek-v4-flash-vision-exp"

[model_providers.hiapi]
name = "HiAPI"
base_url = "https://api.hiapi.ai/v1"
env_key = "HIAPI_API_KEY"
wire_api = "responses"

Already have this file?

Leave config.toml unchanged. If hiapi.config.toml already exists, update its top-level model, model_provider, and the fields in [model_providers.hiapi]. Preserve other settings; do not duplicate keys or tables.

2Set your API key in the terminal

Open a terminal (bash / zsh), replace YOUR_HIAPI_API_KEY with your key, then run the command below. Do not put this command in the configuration file. Manage API Keys ↗

Copy command
export HIAPI_API_KEY="YOUR_HIAPI_API_KEY"

3Start your agent in the same terminal

In the terminal where you set the key, change to your project directory and run the command below. It loads hiapi.config.toml and preserves your default configuration. Set the key again when opening a new terminal. After starting the agent, send a message and check your request logs.

Start command
codex --profile hiapi

4Confirm the connection with one message

After starting, send this in the same Agent conversation:

Reply with only HIAPI_OK. Do not read or modify files.

After receiving the text, check request logs for the model and status; copying this prompt does not prove a connection. View request logs ↗

No reply?

Check your API Key, request logs, model, and CLI version first. Reasoning models may take longer; do not blindly set a very low output limit, force reasoning off, or change existing configuration.

Protocol: Responses APIOfficial configuration guide ↗