EN ▾
Get API key

Codex VS Code API Key: Use a Custom Endpoint

Searching for a codex vscode api key setup? It comes down to three values: the key, the base URL and the model ID. Below is where to put them in the Codex extension, in Continue and in other VS Code coding tools that accept an OpenAI-compatible endpoint.

Updated

A code editor window connected by a glowing key and cable to a server cube, illustrating a VS Code API key setup
A glowing cable connecting a laptop to a server cube, illustrating pointing a client at an API base URL

Key points

  • Base URL: https://api.getcodexapi.com/v1. Model ID: uncensored. Auth: your key as a Bearer token.
  • Codex reads a config file for custom providers; other extensions have a base URL field in settings.
  • Check each extension's current documentation, since settings names change between versions.
  • This is a general uncensored text model, not an OpenAI product, so test it on your own code before relying on it.

What you are setting up

Coding assistants in VS Code talk to a model over HTTP. Most speak the OpenAI API format, which means they accept a custom base URL and key instead of the vendor default. This service is OpenAI-compatible, so it plugs into any tool that offers that option.

Be clear about what is on the other end. It is one open-weight model run by an independent provider, tuned to answer without content refusals for lawful adult use. It is not OpenAI's Codex model and not any other vendor's official API. It is text only, with a 100,000-token window, tool calling and JSON mode. If you want the details of the OpenAI-style routes, read the docs; if you only need the address, see the page on the Codex API base URL.

Here are the three values to use everywhere:

SettingValue
Base URLhttps://api.getcodexapi.com/v1
Modeluncensored
HeaderAuthorization: Bearer YOUR_KEY

Get a key and test it first

Create an account on the API key page with Google or with email and password. New users can claim $0.50 of trial credit with one click, valid for 7 days, no card required. Then test the key in a terminal before touching VS Code. A working curl call proves the key and URL, so later errors are about the extension.

# macOS or Linux, add to ~/.zshrc or ~/.bashrc
export CODEX_API_KEY="YOUR_KEY"

# then verify the endpoint answers
curl https://api.getcodexapi.com/v1/chat/completions \
  -H "Authorization: Bearer $CODEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"Write a Python one-liner that reverses a string."}]}'

The reply is chat completions JSON, and the response carries an X-Balance-USD header with your remaining credit. Keep the key in an environment variable or the extension's secret storage, never in a repository.

Codex extension and CLI: config file

OpenAI's Codex tooling supports custom model providers through a TOML config file in your home directory, and the VS Code extension is documented to share that configuration with the CLI. Verify this against the current Codex documentation for your version, since the format has evolved.

# ~/.codex/config.toml
model = "uncensored"
model_provider = "custom"

[model_providers.custom]
name = "Custom endpoint"
base_url = "https://api.getcodexapi.com/v1"
env_key = "CODEX_API_KEY"
wire_api = "chat"

Points to check:

  • base_url ends in /v1, with no /chat/completions.
  • env_key is the name of the environment variable, not the key itself.
  • wire_api selects the request format. This service accepts both POST /v1/chat/completions and POST /v1/responses. Try "chat" first; use "responses" if your Codex version requires it.
  • Start VS Code from a shell that has the variable set, or restart it after you add the variable to your profile. A GUI launch on macOS often does not see shell exports.

Agent-style tools rely on tool calling. It is supported here, including streamed tool calls, but quality varies by model, so run a small task first. The related page on using the API in Cursor covers a similar setup in another editor.

Continue, Cline and other extensions

Third-party extensions each have their own screen, but the pattern is constant: choose an OpenAI or "OpenAI-compatible" provider, then fill in base URL, key and model. Continue uses a YAML config:

# Continue (config.yaml), model entry
models:
  - name: Hosted uncensored
    provider: openai
    model: uncensored
    apiBase: https://api.getcodexapi.com/v1
    apiKey: YOUR_KEY

Cline and Roo Code offer an "OpenAI Compatible" provider in their settings panel with the same three fields. Names and menus change often, so search the extension's own docs for "OpenAI compatible" or "custom base URL". If an extension has no field for the base URL, it cannot use this endpoint.

Tips that save time:

  • Disable tab-autocomplete against the hosted model unless you want a request on every pause. Chat and edit actions are cheaper.
  • Set a smaller context in the extension for everyday edits. Sending whole repositories to the model costs input tokens every time.
  • Use a separate key per tool so you can tell which one uses your credit.

Which editor tasks suit this model

A general text model with a large window is a fair fit for several everyday jobs: explaining unfamiliar code, writing unit tests for a function, converting a script between languages, drafting docstrings and regex, and rewriting a module when you paste the whole file. The 100,000-token window means a few medium files plus your instructions fit in one request, and the completion can use whatever is left.

Be realistic about the rest. It is not a specialised coding model with editor-aware training, so large multi-file agent runs may need more guidance and more checking than you would give a tool built for them. Ask for diffs instead of whole files, review every change before accepting it, and run your tests. If a task needs content a filtered assistant refuses, such as writing mature fiction scaffolding or security-research text for lawful use, an endpoint without content refusals is the reason to use this one.

What it costs in an editor

Prices are $0.15 per 1M input tokens and $0.50 per 1M output tokens. Coding tools send a lot of context, so look at input first.

Example: an edit request with 8,000 tokens of file context and a 600-token answer costs 8,000 x $0.15 / 1M + 600 x $0.50 / 1M = $0.0012 + $0.0003 = $0.0015. A day of 150 such requests costs 150 x $0.0015 = $0.225. Twenty working days: $4.50.

An agent that reads many files can send 40,000 tokens per step. At that size one step costs $0.006 plus the output, so 100 steps cost about $0.60 plus output. Keep an eye on agent loops. Failed or refused requests are not charged, and credit never expires. Top-ups from $20 to $500 can be paid by card (Visa, Mastercard, Apple Pay, Google Pay) or crypto. Current plans are listed on the pricing page.

Troubleshooting

401 Unauthorized

The key is missing, has a stray space, or the environment variable is not visible to VS Code. Restart the editor from a terminal that has the variable.

404 or "model not found"

Use the exact model uncensored and the base URL with /v1 at the end.

429 errors

A full key allows 8 concurrent requests and 300 per minute; the trial key allows 2 and 60. An extension that fires several parallel requests, such as autocomplete plus chat, can reach the concurrency limit. The error code is concurrency for too many at once and rate_limited for per-minute limits. A Retry-After: 5 header means temporary overload.

Streaming stalls

Some corporate proxies buffer server-sent events. Test from a different network or turn streaming off in the extension.

Answers differ from what you saw with another assistant

That is expected. This is a different model with its own strengths. Give it clear, specific instructions and test it on code from your own project.

Questions and answers

Is this the same as an OpenAI Codex API key?

No. It is a key for a different service with an OpenAI-compatible API and one model, uncensored. It works only with tools that let you set a custom base URL.

Which base URL do I enter?

https://api.getcodexapi.com/v1. Do not append /chat/completions.

Can I try it without paying?

Yes. New users can claim $0.50 of trial credit with one click after sign-up. It lasts 7 days and needs no card.

Does the VS Code extension I use support custom endpoints?

Check its settings and documentation for a base URL or OpenAI-compatible option. If there is none, it cannot connect to this service.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key