LLM API

Responses

Create a model response in the format of OpenAI's Responses API, with the hosted tools that a model enables.

POST /v1/responses creates a model response in the format of OpenAI's Responses API.

The provider of the model must support the Responses API. For an OpenAI or Azure OpenAI model, also set responses_api: enabled in the model's params. Hosted tools, such as web_search and code_interpreter, are available here and not from chat completions. See OpenAI and Azure OpenAI.

Create a response

POST https://data.spiceai.io/v1/responses

Headers

HeaderTypeDescription
X-API-KeystringYour project API key
Content-Typestringapplication/json

Body

The body follows OpenAI's request schema. These are the fields that most requests use. OpenAI's reference lists every field.

FieldTypeDescription
modelstringThe name of a model in the Spicepod of the project.
inputstring or arrayText, image, or file inputs to the model. Required.
instructionsstringA system or developer message for the model.
streambooleanStream the response as server-sent events.
toolsarrayThe tools that the model can call, such as the hosted tools it enables.
tool_choicestring or objectWhich tool the model calls.
previous_response_idstringThe ID of an earlier response, to continue its conversation.
max_output_tokensintegerThe most tokens that the response can use, reasoning tokens included.
temperaturenumberThe sampling temperature, from 0 to 2.
reasoningobjectReasoning options, for a reasoning model.
textobjectThe format of the text output, such as a JSON schema.
curl -X POST "https://data.spiceai.io/v1/responses" \
  -H "X-API-Key: <project-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": "Summarize the open support tickets.",
    "stream": false
  }'

Response

A response object. output holds the model's messages and tool calls, and usage counts the tokens.

{
  "id": "resp_68a4ed5e2258819485ece563a803bbf2075163a5e5b1c982",
  "object": "response",
  "created_at": 1755639134,
  "model": "gpt-4o",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "id": "msg_68a4ed5eb7e88194bf0b2560d8b5c0c1075163a5e5b1c982",
      "role": "assistant",
      "status": "completed",
      "content": [{"type": "output_text", "annotations": [], "text": "Thank you! How can I assist you today?"}]
    }
  ],
  "usage": {"input_tokens": 13, "output_tokens": 11, "total_tokens": 24}
}

Errors

StatusCause
400The provider of the model does not support the Responses API, or the request is not valid.
404No model has this name.
500The runtime failed while it created the response.
503The model is not available from the Responses API.