Public preview: This API is in public preview. Endpoints, schemas, and limits may change before general availability.

Create a response

Full reference for POST /v1/responses — every field, every shape, every default.

Generate a response from a user message. This is the single conversational endpoint on EU GPT.

Endpoint#

POST /v1/responses
Authorization: Bearer eugpt_<token>
Content-Type: application/json

The full reference is at API reference. This page documents the request and response shapes in prose so you can read top-to-bottom.

Request body#

{
  model?: string,                  // default: "auto"
  input: string | ContentItem[],   // required
  stream?: boolean,                // default: true
  instructions?: string | null,
  conversation_id?: string | null, // UUID
  project_id?: string | null,      // UUID
  visible?: boolean,               // default: false
  max_output_tokens?: number | null,
  response_format?: object | null,
}

Fields that are not listed here, such as temperature, tools, or previous_response_id, are ignored.

model#

"auto" (the default) lets EU GPT choose the model; today that is Qwen3.5 397B. Pass a model id from GET /v1/models to use that model. An unknown id returns 400 with model_not_found. The response’s model field reports the model used. See Models for the list and when to use which, and Pricing for the price per model.

"model": "auto"

input#

The user message. Either a plain string, or a list of ContentItems when you want to attach files.

String form:

"input": "Summarise the Q3 audit in three bullets."

Structured form:

"input": [
  {
    "role": "user",
    "content": [
      { "type": "input_file", "file_id": "123e4567-e89b-12d3-a456-426614174000" },
      { "type": "input_text", "text": "Summarise this audit in three bullets." }
    ]
  }
]

Each ContentItem has:

  • role (optional) — usually "user". It is not used.
  • content — a list of parts. Each part is either { "type": "input_text", "text": "…" } or { "type": "input_file", "file_id": "<uuid>" }, with a file id from the Files API. A plain string as content is not accepted.

Send one message per request. Only the first input_text part is used as the question, so an OpenAI-style list of earlier user and assistant turns does not work as history: use conversation_id for that. All file parts are used. See Using files as context.

An empty question returns 400; a missing input returns 422.

stream#

Boolean. Defaults to true. When true, the response is Server-Sent Events. When false, the response is a single JSON document.

"stream": false

See Streaming for the trade-offs and Streaming events for the event taxonomy.

instructions#

System prompt for this response. Steers tone, format, persona, language. EU GPT applies it with priority over the conversation’s or agent’s own instructions.

"instructions": "Always respond in Dutch. Cite sources when using web_search."

On a request without conversation_id, the instructions are also saved with the new conversation. With a conversation_id, they apply to this response only.

conversation_id#

UUID of an existing conversation. Append to it. The conversation must belong to the user that created the API key; otherwise the request returns 404.

"conversation_id": "8f14e45f-ceea-467a-a4ed-a9e9a5cb16ee"

Omit (or pass null) for a stateless request. The id of a stateless request’s conversation is not returned. See Conversations for how to find a conversation’s id.

project_id#

UUID of an agent (project) whose files are searched for this answer. You must be a member of the agent; otherwise the response is 403. An id that does not exist returns 404.

"project_id": "1c8b9a7f-2d3e-4f5a-9b8c-7d6e5f4a3b2c"

project_id applies to requests without conversation_id: the new conversation is created in that agent. An existing conversation keeps the agent it belongs to.

visible#

Boolean. Defaults to false. A request without conversation_id creates a conversation that is hidden from the web app. Set visible: true to show it in the sidebar, like a chat the user started. Ignored when you pass a conversation_id.

"visible": true

max_output_tokens#

Upper bound on the number of tokens the model may generate for this response. Use it to cap output length and the cost of a single request: before the request runs, EU GPT reserves the input plus this whole output budget from your prepaid balance, so a lower value also ties up less credit.

"max_output_tokens": 1024

Omit (or pass null) for no explicit cap, in which case the selected model’s own maximum applies. A value larger than the model’s maximum is silently clamped to that maximum, so you can pass a generous number safely. Must be a positive integer.

When the answer is cut off because the budget ran out, the response has status: "incomplete" and incomplete_details: { "reason": "max_output_tokens" }.

response_format#

Ask for JSON instead of prose, in the Chat Completions shape: { "type": "json_object" }, or { "type": "json_schema", "json_schema": { "name": …, "schema": …, "strict": true } }. A request with response_format runs without tools. See Structured outputs.

Response — non-streaming (stream: false)#

{
  id: string,                     // UUID of this response
  object: "response",
  created_at: number,             // Unix epoch seconds
  status: "completed" | "incomplete",
  model: string,                  // the model used
  output: OutputItem[],           // the message, then any tool calls
  output_text: string,            // all text the model wrote
  generated_files: GeneratedFile[],
  incomplete_details?: { reason: "max_output_tokens" },
}
  • output_text is the convenience field. For plain-text consumers this is all you need.
  • output starts with the assistant message (type: "message", with an output_text content part), followed by the tool calls the model made (type: "function_call", with name, arguments, output, and status).
  • generated_files lists the files that tools created, each with filename, content_type, size, and the key you download it with. See Tools.

A request that EU GPT refuses (bad input, no access, not enough credit) returns an HTTP error with a JSON body, not a response object. If the model itself fails during generation, the response can still be 200 with an empty output_text; check for that, or stream and watch for the error event.

Response — streaming (stream: true)#

Content-Type: text/event-stream. Each event has the shape:

event: message
data: { "type": "<event-name>", "sequence_number": <int>, … }

The full event reference is at Streaming events. The minimum sequence is:

response.created
response.output_item.added    (the assistant message)
response.content_part.added
response.output_text.delta    (one or more)
response.output_text.done
response.completed

The stream ends with response.completed, with response.incomplete when max_output_tokens cut the answer off, or with an error event. An error event means the response failed, even if response.completed follows it.

Examples#

Minimal stateless string input#

curl https://api.eugpt.ai/v1/responses \
  -H "Authorization: Bearer $EUGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"Hello, world.","stream":false}'

Multi-turn conversation#

curl https://api.eugpt.ai/v1/responses \
  -H "Authorization: Bearer $EUGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "input": "And what was the previous answer in one sentence?",
    "conversation_id": "8f14e45f-ceea-467a-a4ed-a9e9a5cb16ee",
    "stream": false
  }'

Agent (project) files#

curl https://api.eugpt.ai/v1/responses \
  -H "Authorization: Bearer $EUGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "What does the 2024 audit say about server costs?",
    "project_id": "1c8b9a7f-2d3e-4f5a-9b8c-7d6e5f4a3b2c",
    "stream": false
  }'