Knowledge Base Sections ▾
Navigation
▸ Start here By rolesCategories
- Cursor + Gonka AI - cheap LLM for coding
- Claude Code + Gonka AI - LLM for the terminal
- OpenClaw + Gonka AI - affordable AI agents
- OpenCode: your own model in the terminal
- Continue.dev + Gonka AI - AI for VS Code/JetBrains
- Cline + Gonka AI - AI agent in VS Code
- Aider + Gonka AI - pair programming with AI
- LangChain + Gonka AI - AI applications for pennies
- n8n + Gonka AI - automation with cheap AI
- Open WebUI + Gonka AI - your own ChatGPT
- LibreChat + Gonka AI — open-source ChatGPT
- Hermes Agent + DeepSeek on the Gonka network — an autonomous agent for pennies
- Kilo Code + Gonka AI — AI-Agent in VS Code
- Roo Code + Gonka AI — Autonomous AI Agent in VS Code
- LlamaIndex + Gonka AI — RAG applications for pennies
- PydanticAI + Gonka — typed AI agents for pennies
- Vercel AI SDK + Gonka AI — AI applications in TypeScript for pennies
- TanStack AI + Gonka — AI applications in TypeScript for pennies
- API quick start — curl, Python, TypeScript
- JoinGonka Gateway — a full overview
- Management Keys — SaaS on Gonka
- Cheapest AI API: Provider Comparison 2026
- Cursor Pro request limit reached — breakdown and cheaper alternative
- Claude Code is cheaper — bill breakdown and switching
- Cline is burning money — why the agent spends so much
- OpenClaw is expensive — why the agent burns through tokens and how to save
- OpenRouter: Cheap Alternative — Comparison with JoinGonka Gateway
- Best AI model for coding in 2026: comparison and prices
- Cheap alternative to GitHub Copilot without limits
- A cheap Windsurf alternative without credits or limits
- The cheapest API for AI agents in 2026
- ZCode: Cheap GLM inference instead of GLM Coding Plan
- JetBrains IDE + JoinGonka Gateway — your own endpoint instead of credits
- GitHub Copilot BYOK — own models instead of quotas
- Zed + JoinGonka Gateway — cheap inference in your editor
- Pi + JoinGonka Gateway — terminal agent on cheap inference
- Codex CLI: your own key instead of a subscription
Tools
Codex CLI: your own key instead of a subscription
Codex CLI is an OpenAI agentic assistant living right in the terminal: it reads project files, runs commands in a sandbox, edits code, and explains what it did. By default, it accesses OpenAI models via a ChatGPT subscription, but you can replace the provider with your own — and then the same scenarios are processed by the Gonka network.
One nuance makes Codex special among agentic tools: it doesn't speak the familiar Chat Completions, but Responses API — OpenAI's new protocol. That is precisely why it was previously impossible to connect it to a third-party gateway. JoinGonka Gateway has been accepting Responses since August 22, 2026, and everything described below has been verified with live runs, not by retelling documentation.
What is Codex CLI and how is it different from chat
Codex is not just an editor suggestion tool, but an independent executor. You state the task in words, and it decides for itself which files to read, which commands to execute, and what to change. It has about a dozen tools at its disposal: running commands, reading files, maintaining a work plan, requesting clarification from the user, and spawning child agents for subtasks.
Two modes of operation. Interactive — codex without arguments, a dialogue in the terminal showing every step. Non-interactive — codex exec "task", a one-time run until completion: convenient in scripts and CI.
Security is built-in: by default, the agent runs in a sandbox and asks for confirmation before making changes. The level of control is set in the configuration — from "ask everything" to a fully autonomous run with write access to the working directory.
Another feature is the dialogue state. Codex does not ask the server to remember anything: it keeps the entire feed itself and sends it back in its entirety with every turn. For you, this means that the correspondence does not settle on the model provider's side, and changing the endpoint does not break an ongoing session.
The difference from Claude Code and other terminal agents is precisely the protocol. Codex communicates with the model via Responses API, where the correspondence is not described as a flat list of messages, but a feed of elements: text, tool call, call result, reasoning block. For a tool, this provides a stricter dialogue model, and for you, it necessitates an endpoint that understands this protocol.
Connection: one edit to config.toml
Codex stores settings in ~/.codex/config.toml. Your custom provider is described by a [model_providers.*] block, and the key field here is wire_api: without it, Codex will try to speak Chat Completions and won't be able to assemble the agentic loop.
# ~/.codex/config.toml
model_provider = "joingonka"
model = "deepseek-ai/DeepSeek-V4-Flash-0731"
[model_providers.joingonka]
name = "JoinGonka Gateway"
base_url = "https://gate.joingonka.ai/v1"
env_key = "JOINGONKA_API_KEY"
wire_api = "responses"The key is not written to the file: env_key names the environment variable from which Codex will take it. The variable name is unique, not OPENAI_API_KEY — so this setting does not intercept your other tools working with OpenAI.
export JOINGONKA_API_KEY=jg-your-keyThe model field sets the default model, and model_provider sets which of the described blocks to use. Both can be overridden at launch time, so one config easily serves several providers: production, experimental, and backup.
The key is issued in the personal cabinet after registration, where balance and usage can also be viewed. If you prefer not to touch the global config, the same block can be passed once via -c: codex -c model_provider=joingonka …. And to keep several independent configurations, specify the settings directory via the CODEX_HOME variable.
Verification: what should happen
The fastest way to ensure the pipeline works is a one-off test run:
codex exec "Answer in one line: how much is 17*3?"In the response header, Codex prints who it is working with: model, provider: joingonka, sandbox mode, and session ID. If your provider is there and an answer arrives at the bottom, the connection is live.
Next, you should test the main thing Codex is installed for—working with files. Place a small file with an obvious error in the directory and ask it to find it:
codex exec "Read calc.py and say in one sentence if there is an error."The agent should automatically call the read tool, open the file, and answer substantively—indicating the line number. If this happens, the full agent loop (request → tool call → result → answer) is correctly assembled through the gateway.
If something goes wrong, the diagnosis is usually readable directly from the message:
| What is visible | What it means | What to do |
|---|---|---|
401 Unauthorized: Invalid API key | Codex didn't find the key or used the wrong one | Verify that the variable from env_key is actually exported in the current shell and its name matches the config |
404 on /responses | The suffix is missing in base_url | The address must end in /v1 — Codex appends /responses itself |
| Model answers, but tools are not called | wire_api is not set, dialog is using the old protocol | Add wire_api = \"responses\" to the provider block |
Reconnecting… 1/5 | Codex is retrying the request itself | Standard behavior for a transient network error; if retries are exhausted, look at the error text below them |
| Warning about bubblewrap | The isolation package is missing from the system | Does not interfere with operation: Codex will use a built-in copy. For tidiness, install bubblewrap via package manager |
The first request in a session may take several seconds: Codex sends a large system prompt and a description of all its tools, and the network node needs to accept the task. Subsequent responses arrive faster.
Which model to choose
All network models are available at a single price, so the choice is about behavior, not budget. Below is the result of a live run of the same task (reading a file and finding an error in it) via Codex on each model.
| Model | Identifier | Context | Behavior in Codex |
|---|---|---|---|
| DeepSeek V4 Flash | deepseek-ai/DeepSeek-V4-Flash-0731 | 380K | Response is clean and to the point, specifying file and line. Longest context in the network and a 32768-token response cap—room for large repositories |
| Kimi K2.6 | moonshotai/Kimi-K2.6 | 200K | Most concise phrasing of the three, calls tools confidently |
| MiniMax M2.7 | MiniMaxAI/MiniMax-M2.7 | 200K | Solves the task correctly, but sometimes thinks out loud—this looks verbose in the terminal |
The default recommendation is DeepSeek V4 Flash: agent work quickly runs into context limits, and 380K tokens allow holding many files in memory at once. If you want extremely short responses, take Kimi K2.6. The model can be changed with one line model in the config or the flag -c model=… without editing the file.
The current list of network models is always available at GET https://gate.joingonka.ai/v1/models.
How much does it cost
Agent tools consume tokens differently than chat: for each of your phrases, Codex adds a system prompt and a description of all tools, then carries out a multi-step dialog with the model. In a live run, a simple task like "read a file and find an error" cost about 18-20 thousand tokens. This is a normal price to pay for autonomy, which is exactly why the price per token matters.
Via JoinGonka Gateway, tokens cost $0.0047 per million input and $0.014 per million output—the price is identical for all network models and is fetched on this page from a live source.
| Scenario | Consumption | Via Gateway |
|---|---|---|
| One-off task (read file, find error) | ~20K tokens | fractions of a cent |
| Day of active work | 3-7M tokens | about a cent |
| Month of active development | ~150M tokens | a few cents |
For comparison, here is how paid options are structured at Codex itself and among competitors:
| Method | Payment model | Limitations |
|---|---|---|
| ChatGPT Subscription | fixed monthly amount | quotas on number of requests and refresh windows |
| OpenAI key directly | by tokens at vendor price | price per million tokens is three orders of magnitude higher |
| JoinGonka Gateway | by tokens, balance | usage visible in the dashboard, no request quotas |
Payment is for actual consumption, without a monthly subscription or request quotas: no five-hour windows, "prompt" limits, or peak-hour multipliers. The balance is topped up with crypto; the remainder and daily usage are visible in the personal dashboard. A detailed breakdown of the economics is in the article about the cheapest AI API.
What to keep in mind
Codex itself maintains the conversation history. It sends the entire history with every request and does not ask the server to remember anything — and we do not store chat logs. Your code and prompts do not remain on the gateway after a response is provided.
Web search is active. Codex declares a search tool in every request, and the gateway accepts it: the search is performed on our side, and the results are injected into the model's response.
Tools are local, not cloud-based. Codex executes commands and reads files locally on your machine, so access to your project does not depend on the model provider.
Sandbox. On Linux, Codex uses bubblewrap to isolate executed commands. If it is not on your system, Codex will warn you and use a built-in copy — this does not affect performance, but installing the package via your standard package manager is more convenient.
If you need image processing — interface screenshots, diagrams in photos — use a tool with a vision-capable model for such tasks: models in the Gonka network are text-only. This is not a limitation for code, commands, and files.
Other terminal agents, if Codex was not the right fit: the API quickstart shows how to connect any compatible tool in a couple of minutes.
Want to learn more?
Explore other sections or start earning GNK right now.
Get key and free tokens →