Tokaify APITokaify API
API Reference
Scenario Examples

Codex (OpenAI / New Platform)

Codex integration guide for Tokaify

Keep these values handy

The examples below use the official Tokaify deployment:

  • OpenAI-compatible Base URL (used in Codex CLI config.toml and most generic clients): https://api.tokaify.com/v1
  • API Key: the full sk-... secret copied from the console
  • Model: choose a model that is enabled for your account, such as gpt-5.4

Step 1: Create a key in Tokaify

  1. Open your platform console and sign in.
  2. Go to Token Management.
  3. Click Add Token and enter a token name.
  4. If needed, also configure quota, allowed models, IP restrictions, and expiration.
  5. After saving, open the action menu for that key and click Copy Access Code. If you need to confirm endpoint or auth details, click View Auth Info.

Important

When connecting a client, always use the full secret directly. Do not remove the sk- prefix.

Step 2: Parameter mapping

ScenarioFieldValueNotes
Codex CLIbase_url in config.tomlhttps://api.tokaify.com/v1/v1 is required here
Codex CLIOPENAI_API_KEY in auth.jsonsk-...Use the full secret
Generic OpenAI-compatible clientsBase URL / API Base / Endpointhttps://api.tokaify.com/v1Most tools like Cursor, Cline, and Cherry Studio use this
Any clientModelgpt-5.4 or another model enabled for your accountDo not force a model your account cannot access

Step 3: Configure Codex

The easiest approach is to copy the secret directly from the token list, then configure config.toml and auth.json as shown below.

Copy the access code from the token list

1. Locate the Codex config directory

~/.codex/
%USERPROFILE%\.codex\

If the directory does not exist:

  • On macOS / Linux, run mkdir -p ~/.codex
  • On Windows, press Win + R and enter %USERPROFILE%\.codex; if it does not open, create the directory manually

2. Put the following at the top of config.toml

~/.codex/config.toml
%USERPROFILE%\.codex\config.toml

Make sure the following block appears near the top of config.toml:

model_provider = "OpenAI"
model = "gpt-5.4"
review_model = "gpt-5.4"
model_reasoning_effort = "xhigh"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true
model_context_window = 1000000
model_auto_compact_token_limit = 900000

[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://api.tokaify.com/v1"
wire_api = "responses"
requires_openai_auth = true

3. Create or overwrite auth.json

~/.codex/auth.json
%USERPROFILE%\.codex\auth.json
{
  "OPENAI_API_KEY": "sk-your-full-secret"
}

4. Field reference

FileFieldValueNotes
config.tomlmodel_providerOpenAIKeep it exactly as shown
config.tomlmodelgpt-5.4 or another available modelDefault model for the main conversation
config.tomlreview_modelgpt-5.4 or another available modelReview model; it can match the main model
config.tomlbase_urlAn OpenAI-compatible Base URL such as https://api.tokaify.com/v1/v1 is required
config.tomlwire_apiresponsesKeep it exactly as shown
auth.jsonOPENAI_API_KEYFull sk-... secretCopy the complete secret from the token list

If your account does not have access to gpt-5.4, replace model and review_model with a model you can actually use.

5. If you are not using the official Codex CLI

Some wrappers provide a graphical provider settings page. In that case, use the following mapping:

UI fieldValue
ProviderOpenAI or OpenAI Compatible
API Keysk-...
Base URLhttps://api.tokaify.com/v1
ModelSelect a model available to your account

Step 4: Verify the setup

The simplest check is to request the model list once:

curl https://api.tokaify.com/v1/models \
  -H "Authorization: Bearer sk-your-token"

If a valid model list is returned, both the key and gateway endpoint are configured correctly.

FAQ

Why does config.toml need /v1

Because Codex CLI expects an OpenAI-compatible API base URL that includes the versioned path. Use https://api.tokaify.com/v1 and do not omit /v1.

Why am I getting 401 or 403

Check these first:

  1. Whether you copied the full sk-... secret
  2. Whether the token is disabled, expired, or out of balance
  3. Whether the current model is allowed by that token
  4. Whether an IP restriction is blocking the request

Why am I getting 404

Most of the time, the endpoint is incorrect:

  • In Codex CLI config.toml, base_url should be https://api.tokaify.com/v1
  • In generic OpenAI-compatible clients, Base URL should also be https://api.tokaify.com/v1

How is this guide?

Last updated on