# GPT-5.1 Codex - Core.Today AI API > GPT-5.1 variant optimized for agentic coding in Codex-style harnesses. Tuned for long tool-use loops, code editing, and repository-scale tasks, and served via the OpenAI Responses API. - **Provider**: OpenAI - **Model ID**: gpt-5.1-codex - **Category**: LLM - **Credits**: 10 per 1K tokens (avg) - **Speed**: Medium - **Quality**: High ## Model Specifications - **Context Window**: 400K tokens - **Max Output**: 128K tokens - **Training Cutoff**: 2025-03 - **Supported Formats**: text, json, markdown - **Compatible SDK**: OpenAI ### Capabilities - Vision (image input) - Function Calling - Streaming - JSON Mode - System Prompt ### Token Pricing (per 1M tokens) - **Input Tokens**: 2,322.5 credits ($1.55) - **Output Tokens**: 18,580 credits ($12.39) - **Cached Tokens**: 232.25 credits ($0.15) ## Features - Optimized for agentic coding harnesses (Codex-style) - Served via the Responses API - this gateway routes Codex models to /v1/responses, not chat completions - 400K context window - Cached input tokens for cost savings on repeated context - Function calling & streaming support ## Use Cases - Coding agents and autonomous dev loops - Large-scale code editing and refactoring - Test generation and bug fixing with tool use - Code review automation ## API Endpoint Base URL: https://api.core.today Endpoint: POST /llm/openai/v1/responses ## Authentication Header: Authorization: Bearer YOUR_API_KEY Note: LLM endpoints use OpenAI-compatible format with Authorization Bearer token. ## Input Parameters ### Required - **model**: string (default: gpt-5.1-codex) - Model identifier - **input**: string | array - Responses API input: a plain string or an array of input items (messages, tool results) ### Optional - **instructions**: string - System-level instructions for the run - **max_output_tokens**: integer - Maximum tokens in the response (Responses API field; not max_tokens) - **stream**: boolean (default: false) - Enable Server-Sent Events streaming ## Examples ### Agentic Coding Task Responses API request for a coding task ```json { "model": "gpt-5.1-codex", "input": "Refactor this function to remove the duplicated error handling, and add a unit test:\n\n", "max_output_tokens": 4000 } ``` ## Response Format ```json { "id": "chatcmpl-abc123", "object": "chat.completion", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Response text here" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 100, "completion_tokens": 50, "total_tokens": 150 } } ``` ## Tips - Works with the OpenAI SDK - set base_url to https://ai.api.core.today/llm/openai/v1 and use client.responses.create() - Codex models are served via the Responses API (POST /llm/openai/v1/responses), not chat completions - Cached input tokens are billed at a ~10x discount - reuse long repository context across turns - Best used inside an agentic harness with tool calling rather than one-shot prompts ## Documentation https://platform.openai.com/docs/models