Reasoning
Effort, token budgets, and encrypted reasoning replay.
Control reasoning effort
Reasoning-capable models allocate part of their output budget to internal reasoning. In Responses use the reasoning object; in Chat use reasoning_effort. Supported values and defaults differ by model.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://www.cheapinference.dev/v1",
apiKey: process.env.CHEAPINFERENCE_API_KEY,
});
const result = await client.responses.create({
model: "gpt-5.4-mini",
input: "Compare two ways to index a document collection.",
reasoning: { effort: "low" },
max_output_tokens: 4096,
store: false,
include: ["reasoning.encrypted_content"],
});
console.log(result.output_text);
console.log(result.usage?.output_tokens_details);Budget for reasoning and visible output
When omitted, the output ceiling defaults to the smaller of 16,384 tokens and the model’s output limit. Set an explicit ceiling to request more. The output ceiling includes reasoning tokens. A small limit can be consumed before the model emits visible text. Increase the limit or lower effort when that happens. Reasoning tokens are a subset of output tokens and are charged once at the applicable output rate.
A model may provide a reasoning summary when requested and supported; this is not a promise of raw internal reasoning. Model-specific reasoning fields pass through unchanged and are validated upstream.
Preserve reasoning context across turns
Request include: ["reasoning.encrypted_content"] and replay complete returned output items in the next request. Keep opaque encrypted values intact. The proxy neither decrypts nor persists them.
Use the stateless conversation example. Do not use previous_response_id, conversation, or item references; those could point into shared provider-account resources.