Models → Pricing → Docs → Blog → Changelog → Contact → Status →
Get started freeLog in

Responses API

The OpenAI Responses format, for the OpenAI SDKs, Codex CLI and other tools that use /v1/responses.

⏱ 6 min read

Endpoint

POST https://freemodel.in/v1/responses

Send your key as Authorization: Bearer fm_…. The key needs the inference scope. Any listed model can be used, with the same plan rules as chat completions; free accounts can use the free models such as gpt-6-luna.

Quick example

curl https://freemodel.in/v1/responses \
  -H "Authorization: Bearer fm_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-luna",
    "instructions": "Answer in one sentence.",
    "input": "What is a context window?"
  }'
from openai import OpenAI

client = OpenAI(api_key="fm_your_key_here", base_url="https://freemodel.in/v1")

resp = client.responses.create(
    model="gpt-6-luna",
    instructions="Answer in one sentence.",
    input="What is a context window?",
)
print(resp.output_text)

Request fields

FieldTypeNotes
modelstringA listed model id. Required in practice: without it the request is refused with 404 model_not_found.
inputstring or arrayRequired. A string is one user message; an array holds input items (below).
instructionsstringSystem instructions, placed before the conversation.
streamboolStream server-sent events. Default false.
max_output_tokensintOutput limit. Values below 8,192 (or no value) are raised to 16,384, so reasoning models have room to answer. max_tokens is read too.
temperaturenumberClamped to 0–2.
top_pnumberClamped to 0–1.
toolsarrayFunction tools, either {"type":"function","name":…,"description":…,"parameters":{…}} or the chat-completions shape with a function object.
tool_choicestring or objectPassed on when tools are present.
parallel_tool_callsboolPassed on when tools are present.
text.formatobject{"type":"json_object"} or {"type":"json_schema","name":…,"schema":{…},"strict":true}. See Structured output.
previous_response_idstringContinue from an earlier response (see below).
storeboolDefault true. Set false and the conversation is not kept for previous_response_id.

Other fields are ignored.

Input items

typeHow it is used
message (or any item with a role)Roles user, assistant, system and developer (treated as system). Content may be a string or parts: input_text / output_text text, and input_image with an image_url (URL or data URL).
function_call / function_call_outputA tool call made earlier and its result, matched by call_id.
custom_tool_call / custom_tool_call_outputSame, for custom (free-text input) tools.
local_shell_call / local_shell_call_outputShell tool calls and results, as sent by Codex CLI.
web_search_callKept as a note of the search query.
reasoning, item_referenceIgnored.

Images need a model with the Vision capability; see Vision.

Response

{
  "id": "resp_3f1c9a0e5b7d2c4a6e8f0b1d",
  "object": "response",
  "created_at": 1795612800,
  "status": "completed",
  "model": "gpt-6-luna",
  "output": [
    {
      "id": "msg_9b2e4f6a8c0d1e3f5a7b9c0d",
      "type": "message",
      "status": "completed",
      "role": "assistant",
      "content": [
        {"type": "output_text", "text": "A context window is the maximum amount of text a model can read and write in one request.", "annotations": [], "logprobs": []}
      ]
    }
  ],
  "output_text": "A context window is the maximum amount of text a model can read and write in one request.",
  "usage": {
    "input_tokens": 31,
    "input_tokens_details": {"cached_tokens": 0},
    "output_tokens": 22,
    "output_tokens_details": {"reasoning_tokens": 0},
    "total_tokens": 53
  }
}

output can also hold reasoning items (with a summary), function_call items (call_id, name, arguments), custom_tool_call, local_shell_call and web_search_call items. output_text is present on non-streamed responses.

Tool calling

tools = [{
    "type": "function",
    "name": "get_weather",
    "description": "Current weather for a city",
    "parameters": {
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"],
    },
}]

r1 = client.responses.create(model="gpt-6-luna", input="Weather in Pune?", tools=tools)
call = next(item for item in r1.output if item.type == "function_call")

r2 = client.responses.create(
    model="gpt-6-luna",
    previous_response_id=r1.id,
    input=[{"type": "function_call_output", "call_id": call.call_id, "output": "31 °C, clear"}],
    tools=tools,
)
print(r2.output_text)

Conversations with previous_response_id

When store is not false, the conversation of a successful response is kept for 7 days. Pass its id as previous_response_id and the stored turns are placed before your new input. Only the account that made the response can use it. An unknown or expired id is treated as no history, so for long-running work you can also send the full conversation in input yourself.

GET /v1/responses/{id} answers with a short object (id, object, status, created_at). It does not return the stored output.

Streaming

With "stream": true the response is a stream of server-sent events, each with an event: line and a JSON data: line carrying type and sequence_number:

EventWhen
response.created, response.in_progressAt the start
response.output_item.added / .doneAn output item opens or closes
response.content_part.added / .doneA text part opens or closes
response.output_text.delta / .doneAnswer text
response.reasoning_summary_text.delta / .doneReasoning summary text
response.function_call_arguments.delta / .doneTool call arguments
response.completedEnd, with the full response and usage
response.failedThe request failed after the stream began
stream = client.responses.create(model="gpt-6-luna", input="Count to five.", stream=True)
for event in stream:
    if event.type == "response.output_text.delta":
        print(event.delta, end="", flush=True)

Errors

Errors use the OpenAI shape. The ones specific to this endpoint:

StatusCodeCause
400bad_requestEmpty request body
400invalid_jsonBody is not JSON
400missing_inputNo usable input
404model_not_foundModel id not listed, or no model sent

Plan, key and rate limit errors are the same as on every endpoint; see Errors and status codes. Billing is the same as for chat completions: input plus output tokens times the model's multiplier, nothing for a failed request.

Was this page helpful?
Still stuck?
Open a support ticket from your dashboard or message our support bot on Telegram.
Telegram supportGet help