Zum Inhalt springen
DeutschlandGPT

Create response

Creates a model response using the stateless Responses API. An alternative to /v2/chat/completions with a simpler input format and richer streaming events.

Accepts a plain string or an array of input items (messages and tool outputs). The store field must be omitted or set to false — only stateless mode is supported.

Prompt caching (Anthropic models). Cache lifetime is five minutes only — ttl: "1h" is NOT supported on this endpoint. Mark the last element of a stable prefix with cache_control and that prefix is cached upstream, so a later request that repeats it byte-for-byte is billed at the cache-read rate. Nothing is cached unless you ask: we never insert breakpoints on your behalf, because whether a cache write pays for itself depends on your access pattern, not on ours. Every cache lives five minutes — ttl: "1h" is accepted but not supported yet, and is reported as marker_ttl_unsupported rather than applied. prompt_cache in the response carries that warning plus any marker we could not place exactly as written. See Billing → Prompt caching.

Prompt caching (Mistral models). Mistral caches prefixes automatically, so cache_control does nothing there — send prompt_cache_key instead: one stable string per conversation or session, repeated on every request that shares a prefix. It is applied unconditionally and costs nothing extra (Mistral has no cache-write premium), your value is namespaced to your workspace, and a hit is a likelihood rather than a guarantee. See Billing → Mistral models.

POSThttps://api.deutschlandgpt.de/v2/responses

Example request

curl https://api.deutschlandgpt.de/v2/responses \
  -X POST \
  -H "Authorization: Bearer $DGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-4o",
  "instructions": "You are a concise assistant. Answer in German.",
  "input": "",
  "stream": false,
  "temperature": 0,
  "max_output_tokens": 0,
  "tools": [
    {
      "type": "function",
      "name": "string",
      "parameters": {}
    }
  ],
  "tool_choice": "auto",
  "parallel_tool_calls": true,
  "text": {},
  "reasoning": {},
  "store": true,
  "prompt_cache_key": "conversation-42",
  "reasoning_effort": "none"
}'

Request body

modelstringrequired

Model ID to use (e.g. gpt-4o, o4-mini). Use /v2/models to list available models.

instructionsstring | nulloptional

A system (or developer) message inserted as the first item in the model's context. The equivalent of a system message on /v2/chat/completions. If your input array already contains a system or developer item, this text is prepended to it — the endpoint supports one system message per request.

inputstring | object[]optional

Text, image, or file inputs. Pass a string for a single user turn or an array of input items for multi-turn conversations.

streambooleanoptional

Stream the response as server-sent events. Events are JSON objects with a type field (e.g. response.output_text.delta, response.completed).

temperaturenumberoptional

Sampling temperature (0–2). Higher = more varied output.

max_output_tokensintegeroptional

Upper bound on tokens to generate. Alias: max_completion_tokens.

toolsobject[]optional

Functions the model may call. Uses flat format — no nested function object.

typestringrequired
namestringrequired
descriptionstringoptional
parametersobjectrequired

JSON Schema for function parameters

strictbooleanoptional
cache_controlCacheControloptional

Cache the tool definitions (and the system prompt with them, since Anthropic orders tools first). Requires a system message in the same request — with none, the marker is dropped rather than moved onto the first user turn, which would change every request and never produce a hit.

typestringrequired
ttlstringoptional

Cache lifetime. On THIS endpoint 1h is NOT SUPPORTED: it is accepted so an existing integration keeps working, but the breakpoint is placed with the default five-minute lifetime, billed at the five-minute cache-write rate (1.25x the input rate, not 2x), and reported as a marker_ttl_unsupported warning in prompt_cache. Because every breakpoint therefore has the same lifetime, mixing the two values is accepted and Anthropic's 1h-before-5m ordering rule is not enforced. 1h IS honoured on /anthropic/v1/messages, where cache_control is Anthropic's own field. Where nothing is cached the markers are ignored entirely.

tool_choicestring | objectoptional

Controls which (if any) tool is called.

parallel_tool_callsbooleanoptional

Allow the model to call multiple tools in a single turn.

textobjectoptional

Output format and verbosity configuration.

formatobject | objectoptional

Output format. Use json_schema for structured output (streaming not supported).

verbositystringoptional

Constrains response length. low = concise, high = detailed.

reasoningobjectoptional

Reasoning model configuration (for o3, o4-mini, etc.).

effortstringoptional

Reasoning intensity. none disables extended thinking and is forwarded to the model as such, so no reasoning tokens are generated or billed. Not every reasoning model accepts every value.

summarystring | nulloptional

Request a summary of the reasoning the model performed, returned as reasoning output items (and as response.reasoning_summary_* events when streaming). Only produced by reasoning models, and only when the effort is above none.

generate_summarystring | nulloptional

Deprecated alias for summary, accepted for older OpenAI SDKs. Prefer summary; if both are set, summary wins.

storebooleanoptional

Accepted for OpenAI-SDK compatibility but always treated as false — only stateless mode is supported. Setting true does not error; the response is still not stored.

prompt_cache_keystringoptional

Optional stable identifier for requests that share a prompt prefix — a conversation, session or workflow id. Raises the prompt-cache hit rate on models that cache prefixes automatically (Mistral). Ignored by models that cache on explicit cache_control breakpoints (Anthropic) and by models with no prompt cache. Your value is namespaced to your workspace server-side, so it can never collide with another tenant or aim at their cache. Hits are best-effort and never guaranteed — a miss is billed exactly like an uncached request, so there is nothing to lose by sending it. Do not put secrets or personal data in it.

reasoning_effortstringoptional

Alias for reasoning.effort, accepted so a /v2/chat/completions request body works unchanged on this endpoint. reasoning.effort wins if both are supplied.

Response

200application/json
{
  "id": "resp_abc123",
  "object": "response",
  "created_at": 0,
  "status": "completed",
  "model": "string",
  "output": [
    {
      "id": "string",
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": null,
          "text": null,
          "annotations": null
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "total_tokens": 0,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    }
  },
  "prompt_cache_key": "string"
}

Response object or SSE stream when stream: true

Also available as text/event-stream

idstring
objectstring
created_atinteger

Unix timestamp

statusstring
modelstring
outputobject[]
idstring
typestring
rolestring
contentobject[]
typestring
textstring
annotationsobject[]
usageobject
input_tokensinteger
output_tokensinteger
total_tokensinteger
input_tokens_detailsobject

The cache split of input_tokens, which is the INCLUSIVE total.

cached_tokensinteger

Input tokens served from the prompt cache, billed at the cache-read rate when prompt caching is enabled for your organisation.

cache_write_tokensinteger

Input tokens written to the prompt cache. Present only when prompt caching is enabled for your organisation.

prompt_cache_keystring | null

The prompt_cache_key you sent, echoed back. null when you sent none.

Response codes

200

Response object or SSE stream when stream: true

object
400

Invalid request or stream: true with json_schema

Error
401

Missing or invalid API key

Error
402

Insufficient credits

Error
403

Feature not enabled

Error
404

Model not found

Error
Was this page helpful?