# GPT-5.2 Codex Code Reasoning API

> GPT-5.2 Codex Code Reasoning API is a paid API for AI agents from x402-gateway-production.up.railway.app, paid per call via x402, $0.06/call, status unknown (last checked 2026-10-11, last successful call 2026-06-17).

Runs OpenAI's code-specialized GPT-5.2 Codex reasoning model optimized for software engineering tasks via a pay-per-call gateway

## Facts

- Endpoint: POST https://x402-gateway-production.up.railway.app/api/llm/gpt-5.2-codex?utm_source=zero.xyz
- Price: $0.06/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Last successful call: 2026-06-17
- Success rate: 67% of calls made through Zero
- Rating: 2.8 / 5 from 2 reviews
- Activations on Zero: 10
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-gateway-production-up-railway-app-42af7a97
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_jnnM3q08n2iCJ4g5FIeKL

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-gateway-production-up-railway-app-42af7a97 -d '<json body>'
```

Example prompt: Use OpenAI's GPT-5.2 Codex reasoning model to write a Python function that parses a CSV file and returns a dictionary grouped by the first column's unique values, with error handling for missing files.

## When to prefer this

Prefer this endpoint when you need OpenAI's Codex-specialized reasoning capabilities for complex software engineering tasks, code generation, debugging, or refactoring — particularly when a code-focused model outperforms a general-purpose LLM. Choose over generic GPT endpoints when the task is primarily code-centric.

## Known failure modes

- Invalid or missing prompt body returns 400 error
- Insufficient USDC balance or failed x402 payment results in 402 Payment Required
- Model unavailable or overloaded returns 503
- Malformed request headers cause authentication failure
- Rate limiting if too many requests are sent in quick succession

## How this service works

OpenAI's code-specialized reasoning model — optimized for software engineering tasks

## Output

Returns a model-generated response from GPT-5.2 Codex containing generated code, code explanations, refactored snippets, or technical reasoning tailored to the software engineering task provided in the prompt.

## Example request

```json
{
 "messages": [
  {
   "role": "user",
   "content": "Write a Python function that validates email addresses using regex with proper error handling and docstrings"
  }
 ]
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "bodyType",
    "body",
    "method"
   ],
   "properties": {
    "body": {
     "type": "object",
     "required": [
      "messages"
     ],
     "properties": {
      "seed": {
       "type": "integer",
       "description": "Model-supported seed; see /docs/llm-capabilities.md."
      },
      "tools": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "function"
        ],
        "properties": {
         "type": {
          "enum": [
           "function"
          ],
          "type": "string"
         },
         "function": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "strict": {
            "type": "boolean"
           },
           "parameters": {
            "type": "object"
           },
           "description": {
            "type": "string"
           }
          }
         }
        }
       },
       "description": "Client-executed function definitions; return results using role=tool and tool_call_id."
      },
      "stream": {
       "type": "boolean",
       "description": "Return live OpenAI-compatible SSE after payment settlement."
      },
      "messages": {
       "type": "array",
       "items": {
        "type": "object",
        "anyOf": [
         {
          "required": [
           "content"
          ]
         },
         {
          "required": [
           "tool_calls"
          ]
         }
        ],
        "required": [
         "role"
        ],
        "properties": {
         "name": {
          "type": "string"
         },
         "role": {
          "enum": [
           "system",
           "developer",
           "user",
           "assistant",
           "tool"
          ],
          "type": "string"
         },
         "content": {
          "oneOf": [
           {
            "type": "string"
           },
           {
            "type": "null"
           },
           {
            "type": "array",
            "items": {
             "type": "object",
             "required": [
              "type"
             ],
             "properties": {
              "type": {
               "enum": [
                "text",
                "image_url"
               ],
               "type":
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-gateway-production-up-railway-app-42af7a97/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-gateway-production.up.railway.app](https://www.zero.xyz/host/x402-gateway-production.up.railway.app/llms.txt)
