Skip to main content
Use the Responses resource when you want the MKA1 API to return text. Start with a plain string for simple prompts. Use message items when you need explicit roles or conversation state. Later sections cover sampling and length limits and reasoning effort. Pausing a background response has its own section in background responses.

Send a simple prompt

Pass a string in input for a single-turn request. The response includes generated text in output_text. If a guardrail blocks the request, output_text is absent and the output carries a refusal instead; see Guardrails.
If you are not acting for an end user, omit X-On-Behalf-Of.

Add instructions

Use instructions to define behavior before the model sees the user input. Keep instructions short and specific.

Send structured messages

Use an array of message items in input when you want explicit roles. Each message item uses type, role, and content.
This pattern is useful when you want the request body to carry the message history directly.

Continue a multi-turn exchange

Use previous_response_id to continue from an earlier response without resending the full history.
If you need a reusable conversation container, create one with the Conversations resource and then pass the conversation ID in conversation.
See the Conversations and Responses pages in the API Reference for the full resource workflow.

Stream text as it is generated

Set stream to true to receive server-sent events instead of waiting for the full response.
Use streaming when you want to render partial output as it arrives.

Tune sampling and length

Sampling fields change how the model picks each token. Length fields cap how much it writes. All of them are optional and sit at the top level of the request, next to model and input.
The gateway validates every value before it calls the model. A value outside its range returns 400. In the example, check status: if the model hit the 400-token cap, the response is incomplete rather than completed, and usage.output_tokens stays at or below the cap. Some fields below are gateway extensions. They are not part of the OpenAI Responses API, and whether they reach the model depends on its upstream, the provider API the gateway forwards your request to, which speaks either the Responses format or the Completions format. top_logprobs is accepted for OpenAI compatibility but the gateway does not forward it to models yet. Fields marked as gateway extensions are not part of the OpenAI Responses API, so the OpenAI SDK’s types do not know them. Send them with the MKA1 SDK, the CLI, or raw HTTP. Four more gateway extensions pass provider options through untouched: chat_template_kwargs (for example {"enable_thinking": false}), prefill_think (a boolean or prefill text), use_cache, and extra_body, an object merged into the upstream request after the gateway strips any auth, base-URL, and header keys from it. These four, and the provider-specific rows in the table, reach only providers other than OpenAI; on an upstream at api.openai.com the gateway drops them.

Check what a model supports

Not every model accepts every sampling field. GET /api/v1/llm/models/{model_id} returns a capabilities object with two booleans: supports_temperature and supports_top_p. Models that are not LLMs (embeddings, images, speech) report false for both.
If you send temperature or top_p to a model that reports false, the gateway does not reject the request. It drops that one field before calling the model, forwards everything else, and the response succeeds with the model’s own default sampling. Nothing in the response says the field was dropped, so check the model’s capabilities first when the setting matters.

Control reasoning

Reasoning models think before they answer. The reasoning object sets how much thinking you want and whether you see it:
  • effort: none, minimal, low, medium, high, or xhigh.
  • summary: auto, concise, or detailed. Asks the model to return a readable summary of its reasoning.
Both keys must be present whenever you send the object. Set the one you are not using to null. {"effort": "low"} on its own fails validation. Whether summary reaches the model depends on the upstream. A Responses-format upstream gets both keys. A Completions-format upstream gets effort (as reasoning_effort) and the gateway drops summary.
The OpenAI SDK’s ReasoningEffort type does not include none or xhigh; send those with the MKA1 SDK, the CLI, or raw HTTP. Reasoning shows up in three places:
  • output can contain an item with type: "reasoning". Its summary array holds summary_text parts, and content (when present) holds the raw reasoning_text parts. Add "reasoning.encrypted_content" to include to get encrypted_content as well.
  • usage.output_tokens_details.reasoning_tokens is the share of output_tokens the model spent thinking. Reasoning tokens are output tokens, so they count against max_output_tokens.
  • In a stream, response.reasoning_text.delta and response.reasoning_summary_text.delta events typically arrive before the response.output_text.delta events. The streaming output latency benchmark shows this order on a live model.
For a model that does not reason, the gateway strips the reasoning object before the call, the same way it drops temperature and top_p for models that do not support them. The request still succeeds. The capabilities object above has no reasoning flag, so there is no way to check this ahead of time; usage.output_tokens_details.reasoning_tokens shows afterwards how much reasoning happened. When you send model: "auto", the gateway applies the organization’s auto policy for Responses. The default is a direct model-registry alias. An organization admin can configure a balanced policy that asks an LLM judge to choose among eligible models using capability, price, gateway latency, comparable evals, request requirements, and conversation continuity. Routing does not change the reasoning.effort you send. Auto routing explains the policy and its failure and privacy behavior.

Pause a background response

A background response can call the sleep tool to wait up to 20 minutes for a webhook or an outside job, and you can wake it early with follow-up input. See background responses.

Next steps