cheapinference.dev
API REFERENCE

Responses

The recommended API for new OpenAI integrations.

Create a response

POST /responses

Responses accepts a text string or an array of messages, reasoning items, and tool results. Use the official OpenAI SDK; its output_text helper extracts text from the native output array.

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://www.cheapinference.dev/v1",
  apiKey: process.env.CHEAPINFERENCE_API_KEY,
});

const response = await client.responses.create({
  model: "gpt-5.4-mini",
  input: "Build something great.",
  max_output_tokens: 1024,
  store: false,
});

console.log(response.output_text);

Parameters

FieldTypeBehavior
modelstring · requiredSupported OpenAI ID; optional openai/ prefix
inputstring or array · requiredFull input/history for this independent request
instructionsstringSystem-level instructions for this request
max_output_tokenspositive integerOutput ceiling, including reasoning; bounded by model capability
reasoningobjectModel-specific effort and optional summary settings
textobjectformat for text/JSON/schema; verbosity where supported
tools / tool_choicearray / string or objectClient tools and tool-selection behavior
parallel_tool_callsbooleanPermit multiple tool calls in one response
streambooleanTyped server-sent events
includearrayreasoning.encrypted_content or message.output_text.logprobs
storefalse or omittedtrue is rejected
truncationdisabled or autoUpstream model’s context-overflow handling
temperature / top_pnumberOptional sampling controls where the model supports them

See parameter ranges and the OpenAPI schema. Unrecognized model-specific fields are validated by OpenAI; router-specific fields are rejected locally.

Read the response

{
  "id": "resp_example",
  "object": "response",
  "status": "completed",
  "output": [{
    "type": "message", "role": "assistant",
    "content": [{ "type": "output_text", "text": "Hello!", "annotations": [] }]
  }],
  "usage": { "input_tokens": 12, "output_tokens": 4, "total_tokens": 16 }
}

Check status. completed is a finished generation; incomplete carries incomplete_details, often because an output limit was reached; failed carries an error. Not every output item is a message—reasoning and tool calls have separate types. Raw HTTP clients should inspect the output array instead of assuming a top-level output_text field.

Continue a conversation without server storage

import OpenAI from "openai";
const client = new OpenAI({
  baseURL: "https://www.cheapinference.dev/v1",
  apiKey: process.env.CHEAPINFERENCE_API_KEY,
});

const history: OpenAI.Responses.ResponseInput = [
  { role: "user", content: "Suggest a name for a reading app." },
];
const first = await client.responses.create({
  model: "gpt-5.4-mini", input: history, store: false,
  include: ["reasoning.encrypted_content"],
});
const second = await client.responses.create({
  model: "gpt-5.4-mini", store: false,
  include: ["reasoning.encrypted_content"],
  input: [...history, ...first.output,
    { role: "user", content: "Give me two more options." }],
});
console.log(second.output_text);

Keep complete output items when replaying, including their IDs, call IDs, and encrypted reasoning. Do not invent or strip fields. Stored response IDs, item references, conversations, prompt templates, file IDs, and background generation are not supported.

Structured outputs · Client tools · Reasoning · Streaming · Image and PDF input