responses api.md

Responses API

The Responses API uses the standard Parasail gateway. Use the base URL below with your existing Parasail API key.

Base URL

https://api.parasail.io/v1

Use your existing Parasail API key for authentication. The API key is the same as for all other Parasail endpoints.

Requirements

Requirement Details
Base URL https://api.parasail.io/v1
store parameter Must be set to false on every request. The gateway does not support server-side state storage. Omitting this will return an error.
Authentication Authorization: Bearer <PARASAIL_API_KEY> (same key as the standard API)

Compatibility

The table below shows which Responses API features are supported.

Feature Supported Notes
Single-turn completions
Multi-turn conversations Pass full conversation history in input
Reasoning / thinking Reasoning content returned automatically for reasoning models
Function / tool calling Define tools with tools parameter
Parallel tool calls Model may issue multiple tool calls in one turn
tool_choice (auto, required, none)
store: true (server-side state) Must set store: false
previous_response_id (stateful chaining) Not supported—pass full history in input instead
Streaming Use stream: true
Web search tool Not currently available
File search tool Not currently available
Computer use tool Not currently available

Quick Start

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://api.parasail.io/v1",
    api_key="<PARASAIL_API_KEY>"
)

response = client.responses.create(
    model="parasail-kimi-k25-elicit",
    store=False,
    input="Explain the difference between TCP and UDP in two sentences."
)

print(response.output_text)

cURL

curl -s https://api.parasail.io/v1/responses \
  -H "Authorization: Bearer $PARASAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "parasail-kimi-k25-elicit",
    "store": false,
    "input": "Explain the difference between TCP and UDP in two sentences."
  }'

Multi-Turn Conversations

Since previous_response_id is not supported, you maintain conversation history by passing the full message array in input. Each turn appends the assistant's reply and the next user message.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.parasail.io/v1",
    api_key="<PARASAIL_API_KEY>"
)

# Turn 1
response = client.responses.create(
    model="parasail-kimi-k25-elicit",
    store=False,
    input=[
        {"role": "user", "content": "I'm planning a trip to Tokyo. What should I see on day 1?"}
    ]
)
turn1_text = response.output_text
print("Turn 1:", turn1_text)

# Turn 2 — pass the full history
response = client.responses.create(
    model="parasail-kimi-k25-elicit",
    store=False,
    input=[
        {"role": "user", "content": "I'm planning a trip to Tokyo. What should I see on day 1?"},
        {"role": "assistant", "content": turn1_text},
        {"role": "user", "content": "What about day 2? Suggest different areas."}
    ]
)
print("Turn 2:", response.output_text)

Function Calling (Agentic)

The Responses API supports tool definitions and multi-step agentic loops where the model calls functions and you return results.

Define Tools

tools = [
    {
        "type": "function",
        "name": "get_weather",
        "description": "Get the current weather for a city.",
        "parameters": {
            "type": "object",
            "properties": {
                "city": {"type": "string", "description": "City name"},
                "units": {
                    "type": "string",
                    "enum": ["celsius", "fahrenheit"],
                    "default": "celsius"
                }
            },
            "required": ["city"]
        }
    }
]

Agentic Loop

from openai import OpenAI
import json

client = OpenAI(
    base_url="https://api.parasail.io/v1",
    api_key="<PARASAIL_API_KEY>"
)

tools = [...]  # as defined above

def handle_tool_call(name, arguments):
    """Your application logic — call real APIs, databases, etc."""
    args = json.loads(arguments)
    if name == "get_weather":
        return json.dumps({"city": args["city"], "temperature": 22, "condition": "sunny"})
    return json.dumps({"error": "unknown function"})

# Initial request
response = client.responses.create(
    model="parasail-kimi-k25-elicit",
    store=False,
    tools=tools,
    input=[{"role": "user", "content": "What's the weather in Tokyo?"}]
)

# Agentic loop — keep going until the model stops calling tools
while response.output:
    tool_calls = [item for item in response.output if item.type == "function_call"]
    if not tool_calls:
        break  # Model produced a final text response

# Build input for next turn: previous output + tool results
    next_input = list(response.output)
    for tool_call in tool_calls:
        result = handle_tool_call(tool_call.name, tool_call.arguments)
        next_input.append({
            "type": "function_call_output",
            "call_id": tool_call.call_id,
            "output": result
        })

response = client.responses.create(
        model="parasail-kimi-k25-elicit",
        store=False,
        tools=tools,
        input=next_input
    )

# Print final response
print(response.output_text)

The model may call multiple tools in parallel within a single turn. Always provide results for every function_call before sending the next request.

Important Notes

curl -s https://api.parasail.io/v1/models \
  -H "Authorization: Bearer $PARASAIL_API_KEY"