Skip to main content
Run Codex CLI, OpenCode or Pi on GLM-5.3, Kimi K3 and DeepSeek V4 with one Hedra API key. Every model has a context length of 1,048,576 tokens, and you pay per token from the same API wallet as your media jobs. Codex connects to POST /v3/responses, and OpenCode and Pi connect to POST /v3/chat/completions, each with a few lines of configuration.

Before you start

  • A key with the chat:write scope and a funded API wallet. See Before you start in the chat completions guide.
  • The key in the HEDRA_KEY environment variable of the terminal that starts the agent:

Choose a model

On 2026-09-30 we had OpenCode, on each model, write unit tests for one module of a large Python repository and run them until they passed. Every model finished in 8 to 14 requests. GET /v3/models returns each model’s current per-token prices.

Connect an agent

The steps below use Codex CLI 0.159.2.
1

Install Codex

2

Add a Codex profile

Save this as ~/.codex/hedra.config.toml:
Codex sends the tool definitions of your ChatGPT apps, such as GitHub and Slack, with every request, which can add tens of thousands of tokens. apps = false leaves them out of Hedra sessions.
3

Start Codex

codex --profile hedra --model moonshotai/kimi-k3 switches models. Hedra maps Codex’s model_reasoning_effort values onto the models’ own: minimal to low, medium to the model’s default effort, and xhigh to max.

Keep sessions inexpensive

An agent sends its instructions, its tool definitions and the conversation so far with every request, and Hedra bills each request’s tokens at the model’s prices. A shorter prompt lowers the price of every request in the session:
  • Turn off the MCP servers a session does not need. Each MCP server adds its tool definitions to every request. In Codex, codex mcp list prints your servers’ names, and -c mcp_servers.<name>.enabled=false turns one off for the session:
    In OpenCode, set "mcp": { "linear": { "enabled": false } } in opencode.json. By default, Pi adds no MCP tool definitions to the prompt.
  • Keep AGENTS.md focused. Codex, OpenCode and Pi send the repository’s AGENTS.md with every request.
  • Leave Claude Code’s files out of OpenCode. OpenCode also reads Claude Code’s instructions and skills from ~/.claude into its prompt. Set OPENCODE_DISABLE_CLAUDE_CODE=1 to leave them out.
GET /v3/usage reports your spend on each model since start, with a key that has the usage:read scope:

Troubleshooting

  • Codex prints Model metadata for zai-org/glm-5.3 not found. Codex has no metadata for Hedra’s models, and the session runs normally without it.
  • A 401 response. Set HEDRA_KEY in the terminal that starts the agent, and restart the agent.
  • A 402 response. Your API wallet’s balance cannot cover the request. Add funds and send the message again.