DOCS · V1

Build with one endpoint.

GPTDev API speaks the OpenAI format. Codex CLI, Cursor, Cline, Continue and the official SDKs work by changing two settings: the base URL and the key. Both /v1/responses and /v1/chat/completions are supported, with streaming, tools, images and reasoning.

BASE URLhttps://api.gptdevapi.com/v1
Always end the base URL with /v1. If a tool adds /v1 by itself it still works, we handle the double path.
01 · QUICKSTART

Running in three steps.

  1. 1
    Create a key
    Sign up, redeem a coupon on the Balance page, then create a key on API keys. The key is shown once.
    dashboard
    sk-gd-a91f••••••••••••••••
  2. 2
    Point your tool here
    Set the base URL and key. Any OpenAI compatible tool or SDK reads them.
    terminal
    export OPENAI_BASE_URL="https://api.gptdevapi.com/v1"
    export OPENAI_API_KEY="sk-gd-your-key"
  3. 3
    Make a request
    Call any model by its id. Codex CLI works with the config from Tool setup.
    terminal
    codex --model gpt-6.2-sol "explain this repo"
02 · AUTHENTICATION

Authentication.

Every request needs your key. Send it as a Bearer token. The x-api-key header also works for tools that only support that.

header
Authorization: Bearer sk-gd-your-key
Keep keys on the server. Never put a key in browser code or a public repo. If a key leaks, delete it on the API keys page and create a new one.

Each key can have its own model list, spend limit, requests per minute limit and expiry date. Edit these from the API keys page.

03 · TOOL SETUP

Tool setup.

Pick your tool. Replace sk-gd-your-key with your own key.

Install with npm i -g @openai/codex, then add a provider to the config file. On Windows the file is %USERPROFILE%\.codex\config.toml. Run codex in any folder.
~/.codex/config.toml
model_provider = "gptdev"
model = "gpt-6.2-sol"
model_reasoning_effort = "medium"

[model_providers.gptdev]
name = "GPTDev API"
base_url = "https://api.gptdevapi.com/v1"
experimental_bearer_token = "sk-gd-your-key"
wire_api = "responses"
requires_openai_auth = false
You can keep the key out of the file: replace experimental_bearer_token with env_key = "GPTDEV_API_KEY" and export that variable.
04 · FIRST REQUEST

Your first request.

Codex CLI uses the Responses API. Older tools use Chat Completions. Both are billed the same way.

POST/v1/responses
curl https://api.gptdevapi.com/v1/responses \
  -H "Authorization: Bearer $GPTDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6.2-sol",
    "input": "Refactor fetchUser to async/await"
  }'
200 OKPOST /v1/responses

RUN shows a sample response. It does not call the API or use your balance.

Main parameters

model
Required. Model id from the list below.
input
Required. A string, or a list of messages with text and images.
instructions
System style instructions for this turn.
stream
true to stream server sent events.
max_output_tokens
Upper bound on output. You pay only for tokens actually used.
reasoning
{ "effort": "low" | "medium" | "high" } for reasoning depth.
tools
Function tools the model can call.
previous_response_id
Continue from an earlier response of yours (kept for 30 days).
05 · STREAMING

Streaming.

Set stream to true. Tokens arrive as server sent events, same format as OpenAI.

Responses API

events
event: response.created
event: response.output_text.delta
data: {"type":"response.output_text.delta","delta":"async "}
...
event: response.completed
data: {"type":"response.completed","response":{"usage":{...}}}

Chat Completions

Chunks end with data: [DONE]. To get token counts in the stream, send "stream_options": {"include_usage": true} and read the last chunk before DONE.

chunks
data: {"choices":[{"delta":{"content":"async "}}]}
data: {"choices":[{"delta":{"content":"function"}}]}
...
data: {"choices":[],"usage":{"prompt_tokens":1284,"completion_tokens":212}}
data: [DONE]
Long tasks are fine. Streams stay open as long as tokens keep coming. If your client disconnects, the request is billed for what was generated up to that point.
06 · REASONING

Reasoning effort.

Models think before answering. Higher effort gives better answers on hard problems and uses more tokens.

low
Fast. Good for small edits and simple questions.
medium
Default for most coding work.
high
Hard bugs, design and large refactors. Slower and more tokens.
request body
{
  "model": "gpt-6.2-sol",
  "input": "Find the race condition in this file",
  "reasoning": { "effort": "high" }
}

In Codex CLI set model_reasoning_effort in config.toml, or switch with /model inside a session. Reasoning tokens show up in your usage log and are billed like other tokens.

07 · ERRORS

Errors.

Errors use the OpenAI shape, so SDKs raise their usual exceptions. Check error.code to see what happened.

response body
{
  "error": {
    "message": "Insufficient balance. Redeem a coupon at /dashboard/balance",
    "type": "insufficient_quota",
    "param": null,
    "code": "insufficient_balance"
  }
}
400
context_length_exceeded
The prompt plus requested output is larger than the model context. Trim history or start a new chat.
400
invalid_json / missing_required_parameter / unsupported_parameter
The body is not valid JSON, a required field is missing, or a field is not supported (for example background mode).
401
invalid_api_key
Key missing, wrong or deleted. Send it as a Bearer token.
402
insufficient_balance
Your balance is empty. Redeem a coupon on the Balance page.
403
model_not_allowed
This key is limited to other models. Edit the key to allow it.
403
key_disabled / key_expired / spend_limit_reached
The key is paused, past its expiry date, or hit its own spend limit.
403
account_suspended
The account is suspended. Contact your admin.
404
model_not_found
No model with that id. Copy one from the Models list below.
404
previous_response_not_found
The previous_response_id does not exist or belongs to another account.
413
request_too_large
The request body is too big.
429
rate_limit_exceeded
Requests per minute limit reached for the key or account. Wait for retry-after seconds.
429
balance_reserved
Your balance is held by requests still running. It clears when one finishes, or redeem more.
502
server_error
Something failed while processing. Safe to retry with backoff.
503
service_unavailable
Service is busy for a moment. Retry after a few seconds.

Retry 429, 502 and 503 with backoff. Do not retry 400, 401, 402, 403 or 404 without changing the request.

08 · RATE LIMITS

Rate limits.

Limits are counted per key, per minute. Your account also has a total across all keys.

Requests per minute
Set per key on the API keys page, up to your account limit.
Concurrent requests
No fixed cap. Each running request holds part of your balance until it finishes.
retry-after
Sent with every 429. Wait that many seconds, then retry.
A 429 with code balance_reserved is not a speed limit. Your running requests have reserved your whole balance. Redeem more balance to run more at once.
09 · MODELS

Models.

Use these ids exactly. GET /v1/models returns the same list with context sizes.

gpt-6.2-sol1.05M ctx · 128K out
gpt-6.1-sol1.05M ctx · 128K out
gpt-6.2-astra1.05M ctx · 128K out
gpt-6-astra1.05M ctx · 128K out
gpt-6-sol1.05M ctx · 128K out
gpt-6-luna1.05M ctx · 128K out
gpt-5.6-sol1.05M ctx · 128K out
gpt-6.1-terraNEW1.05M ctx · 128K out
gpt-5.6-terra1.05M ctx · 128K out
gpt-5.6-luna1.05M ctx · 128K out
gpt-5.51.05M ctx · 128K out

Prices for each model are on the Models page.

10 · BILLING

Billing.

Simple: one price per model, per million tokens.

Every token counts the same
Input, output, cached and reasoning tokens all use the model price. No separate rates.
Pay for what you use
Billing uses the real token count of each request, not the max you asked for.
Balance
Add balance with coupon codes on the Balance page.
Usage log
Every request is listed with tokens and cost. Export as CSV from the Usage page.
11 · COMMON PROBLEMS

Common problems.

404 on every call
Your base URL is missing /v1, or has a typo. Copy it from the top of this page.
Codex asks you to log in
Set requires_openai_auth = false and make sure model_provider = "gptdev" is at the top level of config.toml, above any [section].
Codex says stream disconnected
Check the status page, then retry. Very long tasks on slow networks can drop; Codex retries on its own.
model_not_found
The id must match exactly. Copy one from the Models list.
Tool shows no models
Some tools do not call /v1/models. Type the model id in by hand.
spend_limit_reached
The key has its own spend limit. Raise or remove it on the API keys page.
Anything else
Contact your admin.