Skip to main content
POST
Generate GPT Chat Completions
Use your GENGEN API key and the OpenAI SDK with https://gengen.farm/v1. This page covers chat, tool execution, supporting resources and conversation state for gpt-6.1-sol, gpt-6-astra, gpt-6-sol and gpt-6-luna. Both interfaces also support the /api/gengen/v1 prefix. Tool features belong to the chat workflow, but hosted tools require Responses. Adding them to a Chat Completions request does not enable them. Paid synchronous text requests, including context compaction, require at least USD 2.00 in credits available for the model. GENGEN checks the balance before sending the request and charges actual usage when it finishes. Concurrent requests can leave the wallet with a negative balance. Hosted tools, stored responses and background work use separate reservations.

Model discovery and Codex setup

GET https://gengen.farm/v1/models lists the public chat models, including the four GPT models, in OpenAI-compatible object: "list" / data format. Send your GENGEN API key as Authorization: Bearer YOUR_GENGEN_API_KEY. The same endpoint is available at /api/gengen/v1/models. Listing models is free and does not require a positive wallet balance.
The OpenAI SDK also supports client.models.list(). Each entry contains id, object: "model", created (0 when the creation time is unavailable), and owned_by. The list contains chat models only; it excludes media-only models. Model availability does not imply identical tool support on both interfaces. For CC Switch with Codex, select the Responses upstream format, set the API base URL to https://gengen.farm/v1, enter your GENGEN API key, and fetch the model list. Select gpt-6.1-sol (or another GPT model), save, and restart Codex. Do not select Chat Completions conversion for reasoning/tool workflows; use Responses to preserve native tool calls and reasoning history. Use HTTP Responses/SSE for this custom provider. Disable Fast/Priority mode; GENGEN uses Standard processing, including when service_tier is auto or omitted. Nullable optional settings are treated as omitted. Legacy user values are scoped to the authenticated caller, like cache and safety identifiers. Only the standard access program is available; elevated access programs and inline moderation are not supported.

SDK quickstart

The response uses native choices and usage. messages, image content parts, response_format, max_completion_tokens, reasoning_effort, cache settings and metadata retain their native shapes. store is always false and n must be 1. Use max_completion_tokens to bound visible and reasoning output together.

Models and reasoning

All four default to medium, accept text and images, and support structured text output. Their context window is 1,050,000 tokens, with up to 922,000 input tokens and 128,000 output tokens including reasoning. Use background: true for long tasks. Hosted foreground requests that exceed the HTTP budget return HTTP 202 with a Location header for continued polling. Sampling and log-probability controls require reasoning effort none on Sol/Luna. Omit them for Sol 6.1 and Astra. Chat function tools and tool-result history also require reasoning_effort: "none" on Sol/Luna; the other models require Responses for tool calling.

Images, files, and structured output

In Responses, use native input_image parts with HTTPS or data URLs. Files accept input_file with an owned file_id, file_url, or filename plus Base64 file_data. POST /files accepts native multipart uploads. The existing JSON Blob upload protocol remains available for media utilities. See Files and resource management. Use text.format for json_object or strict json_schema output. instructions, reasoning.summary, text.verbosity, include, truncation, metadata and prompt cache options pass through. temperature, top_p and log probabilities require reasoning.effort: "none" on Sol/Luna; omit them for the other models.

Responses and tools

Declare tools in client.responses.create(tools=[...]). For example:
Tool declarations, tool_choice, parallel_tool_calls, max_tool_calls, custom arguments, approval decisions, and tool result items retain their native shapes. The API does not execute client tools or acknowledge safety checks on your behalf. See Function calling for application execution patterns.

Tool examples

For stateless conversations, preserve all output items, including encrypted reasoning, and return a result for every call before continuing:
Native multipart uploads support assistants, user_data and vision. The multipart body, including the file and fields, must fit within 4 MB. Files expire seven days after creation. HTTPS file URLs can supply larger model inputs when the upstream supports the format; inline data must still fit the HTTP request limits. Resumable OpenAI Uploads and arbitrary global file discovery are not provided. The existing JSON Blob media-upload protocol on /files remains supported.Vector stores reserve up to 1 GB of capacity for 24 hours from creation. Creation purchases this fixed capacity period; deleting early does not refund the reservation. Activity does not extend it. Retrieval monitors the size, and the cleanup service removes stores that exceed capacity or reach expiry. Create a new store for another period. File indexing is asynchronous: poll before searching.Supported operations include owned list/create/retrieve/delete; vector-store name, description and metadata updates; attach/list/retrieve/update/delete files; create/retrieve/cancel file batches and list batch files; and POST /vector_stores/{id}/search. Use at most twenty file IDs per create/attach-batch request. Root resource lists are scoped metadata snapshots; retrieve a resource for live upstream status.File content downloads remain subject to upstream restrictions for the file’s purpose; an uploaded input document may be unavailable for download even when it can be indexed and searched. Keep the original document in your application. Use the container file content endpoint to download Code Interpreter artifacts.
For explicit container management:
Code Interpreter also accepts an owned container ID string. Hosted shell supports container_auto and container_reference; local shell remains application-executed. Containers support 1, 4, 16 and 64 GB memory, owned input file IDs, native network policies, inline skills and supported first-party skills. Shared custom skill IDs are unavailable. First-party skill access depends on upstream availability.A new container purchases one session. GENGEN’s fixed deadline is 19 minutes from upstream creation, within the provider’s twenty-minute session window; activity does not renew it. A reference with less than five minutes remaining is rejected so you can create a new session. A reused owned container is not charged again within its session. Download artifacts before expiry using GET /containers/{id}/files/{fileId}/content. Container file upload, list, retrieve and delete endpoints are available. Containers are temporary sandboxes, not persistent storage.
For 2.6, use native tool fields complexity, output_format, frame_count, and frame_duration_ms. GIF output is priced by megapixels across all frames. SVG includes the service price for its rendered reference and the measured author tokens. The native tool returns Base64 output. Use the Image API for markup-guided edits or hosted output URLs.For SVG, tools[].svg.model is optional. With SVG author selection enabled, omit it to use the outer Responses model. For example, "svg": {"reasoning": {"effort": "low"}} sets only the author’s effort. An explicit author override uses that author’s supported efforts. Without author selection, OpenAI uses its default author and does not accept a model override. See the OpenAI Responses reference.The image models are gpt-image-2.6-flare, gpt-image-2.6-sunburst, gpt-image-2.5-flare, gpt-image-2.5-sunburst and gpt-image-2. Defaults are GPT Image 2.5 Flare, 1024x1024 (or auto for GIF), and medium. Native rendering, background, output format/compression, editing and partial-image options pass through. Sizes may be auto or dimensions divisible by sixteen, within a 1:3 to 3:1 aspect ratio and the model’s maximum of 3840×2160 pixels. Flare and Sunburst also accept xhigh and max quality. Provider-specific size constraints still apply. Previous response IDs and owned image item references enable iterative edits.Image tools use a fixed GENGEN image service price per output megapixel and quality, plus the parent model’s measured tokens. This differs from the dedicated image endpoint’s token pricing. The upstream image tool does not expose complete independent image token usage; GENGEN does not invent it or claim an exact upstream image cost. Check current final service prices before generating.For a standalone image request without a GPT conversation, use the Image API.

Files and resource management

Files, containers and vector stores support chat tools through separate resource endpoints. Resources belong to the creating account, workspace and API key; use that same key for subsequent requests. IDs from OpenAI directly or another GENGEN key are unavailable. Root lists return scoped metadata snapshots; retrieve a resource for its live status. See the OpenAPI specification for every operation’s parameters and response schema. Resource SDK examples are in Tool examples.

Stored and background responses

Set store: true to retain a response. Once it has finalized, pass its ID in previous_response_id to continue the conversation with the same key and workspace:
Plain requests default to stateless execution. Hosted tools and owned resource references use durable execution and default to store: true. Explicit store: false retains recovery state for at most ten minutes. Only a finalized stored response can be used as previous_response_id.
Responses keep native IDs and snake_case fields. Stored responses expire after thirty days; explicit store: false permits a ten-minute recovery window. Stored previous responses must be finalized before reuse. GET /responses/{id}/input_items is supported. Long foreground hosted calls may return HTTP 202 with a Location header; continue polling that response ID. Set both background: true and stream: true to receive native SSE and later resume with GET /responses/{id}?stream=true&starting_after={sequenceNumber}. Sequence numbers and tool events retain their native shape. Only a response originally created with streaming can be resumed this way. A disconnect leaves hosted work running; cancel explicitly. Usage proven before cancellation remains billable. Wallet settlement precedes terminal events and terminal retrieval.

Long conversations and compaction

To enable server-side compaction during generation, add context_management: [{"type": "compaction", "compact_threshold": 200000}] to a Responses request. At most one entry is supported; an explicit threshold must be an integer of at least 1000 tokens. Preserve encrypted compaction items in conversation history just like other native output items. For explicit compaction, use POST /v1/responses/compact:
The compact endpoint returns a native response.compaction object with id, created_at, output, and usage. Pass the complete output into the next request. It supports instructions, caller-scoped prompt-cache settings, and an owned, stored, settled previous_response_id. It does not stream or execute tools. Compaction uses the model’s token prices and requires wallet balance; settlement finishes before the compacted window is returned. Retained historical tool calls are not charged again. If submission is ambiguous, do not automatically repeat it.

Streaming and billing

Set stream: true to receive native typed SSE events, including text, reasoning summaries, tool argument deltas, citations, approvals and tool status events. Responses ends with response.completed, response.incomplete, response.failed, or response.cancelled; it does not use Chat Completions’ [DONE] marker. Responses accepts stream_options: {"include_obfuscation": false} with stream: true, including requests from Codex through CC Switch. This native option controls the upstream stream’s padding fields and is passed through unchanged. Omit it to keep the upstream default; null and an empty object are also accepted. Codex’s reasoning_summary_delivery: "sequential_cutoff" and boolean include_usage are accepted as compatibility hints and consumed locally. They are not forwarded to the public upstream API: summary delivery follows native SSE behavior and Responses usage still comes from terminal events. Wallet settlement finishes before the terminal event is delivered. A local transport or settlement failure emits event: error and closes without a successful terminal event. Treat deltas as provisional. Disconnects do not automatically resubmit work. Requests with ambiguous provider acceptance retain their reservation for reconciliation. Measured input, cached input, cache writes, and output are billed separately. Reasoning tokens are already included in output tokens. Web search has an additional per-call charge; retrieved content tokens are included in model usage. Prompts above 272,000 input tokens use the long-context price for the full request. Check Pricing for current final customer prices. Chat Completions uses native text/function-argument deltas and ends with [DONE]. Usage is requested upstream even if stream_options.include_usage was false. Finish/usage chunks and [DONE] follow wallet settlement; a billing failure emits an error without [DONE]. The same measured token rates and reconciliation rules apply to both interfaces. GET /v1/openai/pricing returns current final USD service prices for tools, images, container sessions and vector capacity. Model token rates are listed on Pricing. File upload/download/list and resource retrieval/deletion have no additional generation fee. File-search calls and direct vector searches have a per-call fee, separate from vector capacity and model input/output tokens. Generation reserves wallet balance before upstream submission, then captures the measured token/tool charge and releases unused funds. Tool limits default to five and accept one to twenty; hosted output defaults to 4096 tokens. Dedicated resource fees use the openai-hosted-resources billing service and cannot consume credits restricted to a GPT generation model. There is a per-account quota of one hundred active root resources and twenty unsettled operations. Send a stable Idempotency-Key for every create or paid operation. Retrying the same key and payload returns the existing result; another payload returns HTTP 409. A lost upstream submission receipt is retained for reconciliation and never repeated automatically. Retry with the same key and contact support if it remains unresolved; changing the key may create another paid operation.

Availability boundaries

Only Standard processing (service_tier: "default") is exposed. Conversation IDs, stored prompt IDs, shared upstream connectors, arbitrary upstream resource IDs, Realtime, Assistants, Batch and WebSocket sessions remain outside this interface. Audio/video input is not supported by these GPT models. Client-side functions, computer actions, patches and local shell commands remain application-executed. Unsupported options and unowned references are rejected before wallet admission. Tool access still depends on the configured upstream project’s model permissions.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
required
Available options:
gpt-6.1-sol,
gpt-6-astra,
gpt-6-sol,
gpt-6-luna
messages
object[]
required
Minimum array length: 1
max_completion_tokens
integer | null
Required range: 1 <= x <= 128000
max_tokens
integer | null
deprecated
Required range: 1 <= x <= 128000
reasoning_effort
enum<string> | null
default:medium
Available options:
none,
low,
medium,
high,
xhigh,
max,
null
tools
object[]

Function declarations only on Sol/Luna with reasoning_effort none.

tool_choice
functions
object[]
deprecated
function_call
deprecated
parallel_tool_calls
boolean | null
response_format
object | null
stream
boolean | null
default:false
stream_options
object | null
temperature
number | null

Requires reasoning_effort none.

top_p
number | null

Requires reasoning_effort none.

logprobs
boolean | null

Requires reasoning_effort none.

top_logprobs
integer | null

Requires reasoning_effort none.

presence_penalty
number | null
frequency_penalty
number | null
stop
seed
integer | null
n
enum<integer> | null
Available options:
1,
null
metadata
object | null
user
string | null

Legacy identifier, hashed in caller scope.

safety_identifier
string | null
prompt_cache_key
string | null
prompt_cache_options
object
prompt_cache_retention
string | null
service_tier
enum<string> | null

Auto and omission use Standard processing.

Available options:
auto,
default,
null
store
enum<boolean> | null
Available options:
false

Response

Native Chat Completion or SSE chunks. Finish/usage chunks and DONE follow wallet settlement.

id
string
required
choices
object[]
required
usage
object
required
object
any
model
string