Skip to main content
Eden AI supports the OpenAI Responses API — a stateful alternative to chat completions that stores conversation history server-side, so you don’t need to resend the full message history on each turn.

Overview

Endpoints:
MethodPathDescription
POST/v3/llm/responsesCreate a response
GET/v3/llm/responses/{response_id}Retrieve a stored response
DELETE/v3/llm/responses/{response_id}Delete a stored response
Provider-Dependent Behavior — The Responses API is a passthrough to the underlying provider. Stateful features (server-side storage, response retrieval/deletion, and previous_response_id chaining) are only available when the provider natively supports the Responses API (e.g. OpenAI). For all other providers, responses are not stored and the retrieve/delete endpoints are not functional.

How It Differs from Chat Completions

Chat CompletionsResponses
System promptmessages[{role: "system"}]instructions top-level field
User inputmessages arrayinput string or array
Response textchoices[0].message.contentoutput[0].content[0].text
Multi-turnResend full historyprevious_response_id
PersistenceStatelessStored by default (store: true)
Token fieldsprompt_tokens / completion_tokensinput_tokens / output_tokens

Create a Response

import requests

url = "https://api.edenai.run/v3/llm/responses"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

payload = {
    "model": "openai/gpt-4o",
    "input": "What is the capital of France?",
    "instructions": "You are a helpful assistant."
}

response = requests.post(url, headers=headers, json=payload)
result = response.json()

print(result["output"][0]["content"][0]["text"])

Request Parameters

ParameterTypeDefaultDescription
modelstringRequiredModel string, e.g. openai/gpt-4o
inputstring | arrayRequiredUser input — a plain string or an array of input items
instructionsstringSystem-level instructions for the model (replaces the system message)
previous_response_idstringChain to a prior response for multi-turn conversations
storebooleantruePersist the response server-side
streambooleanfalseEnable streaming via SSE
temperaturefloat1.0Randomness (0–2)
max_output_tokensintegerMaximum tokens to generate
top_pfloat1.0Nucleus sampling threshold
toolsarrayTool definitions (function calling, web search)
tool_choicestring | object"auto"How the model selects tools
truncationstring"disabled"Truncation strategy: "auto" or "disabled"
metadataobjectArbitrary key-value pairs attached to the response
userstringStable identifier for the end-user

Response Object

{
  "id": "resp_abc123def456",
  "object": "response",
  "created_at": 1710000000,
  "model": "openai/gpt-4o",
  "status": "completed",
  "instructions": "You are a helpful assistant.",
  "output": [
    {
      "id": "msg_abc123",
      "type": "message",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The capital of France is Paris."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 20,
    "output_tokens": 9,
    "total_tokens": 29
  },
  "provider": "openai",
  "cost": 0.000087,
  "provider_time": 1.23
}

Top-Level Fields

FieldTypeDescription
idstringUnique response identifier
objectstringAlways "response"
created_atintegerUnix timestamp of creation
modelstringModel that produced the response
statusstring"completed", "in_progress", "incomplete", or "failed"
instructionsstringSystem instructions used
outputarrayList of output items (messages, tool calls, reasoning)
usageobjectToken consumption
errorobjectPresent when status is "failed"
providerstringEden AI: provider name extracted from the model string
costfloatEden AI: estimated cost in USD for this request
provider_timefloatEden AI: provider response time in seconds

output[] Item Types

typeDescription
messageAssistant text response
function_callA tool/function call requested by the model
reasoningReasoning steps (o-series models only)
web_search_callWeb search tool invocation

usage Fields

FieldTypeDescription
input_tokensintegerTokens consumed by the input
output_tokensintegerTokens generated in the response
total_tokensintegerSum of input and output tokens

Multi-Turn Conversations

Because responses are stored server-side, you only need to send the new user message and reference the prior response ID:
import requests

url = "https://api.edenai.run/v3/llm/responses"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

# First turn
res1 = requests.post(url, headers=headers, json={
    "model": "openai/gpt-4o",
    "input": "What is the capital of France?",
    "store": True
}).json()

print(res1["output"][0]["content"][0]["text"])

# Second turn — no need to resend history
res2 = requests.post(url, headers=headers, json={
    "model": "openai/gpt-4o",
    "input": "What is its population?",
    "previous_response_id": res1["id"]
}).json()

print(res2["output"][0]["content"][0]["text"])
previous_response_id chaining only works for providers with native Responses API support. For other providers, responses are not stored server-side — you must manage conversation history client-side (e.g. by resending the full message array, as with chat completions).
Pass store: false if you don’t need persistence and want to keep the conversation stateless, like chat completions.

Retrieve a Response

This endpoint only works for providers with native Responses API support. For other providers, responses are not stored and this endpoint will return an error.
Fetch a previously stored response by ID:
import requests

response_id = "resp_abc123def456"
url = f"https://api.edenai.run/v3/llm/responses/{response_id}"
headers = {"Authorization": "Bearer YOUR_API_KEY"}

result = requests.get(url, headers=headers).json()
print(result["output"][0]["content"][0]["text"])

Delete a Response

This endpoint only works for providers with native Responses API support. For other providers, responses are not stored and this endpoint will return an error.
Remove a stored response. The response will no longer be retrievable or usable as a previous_response_id:
import requests

response_id = "resp_abc123def456"
url = f"https://api.edenai.run/v3/llm/responses/{response_id}"
headers = {"Authorization": "Bearer YOUR_API_KEY"}

result = requests.delete(url, headers=headers).json()
print(result)  # {"id": "resp_abc123def456", "deleted": true}

OpenAI SDK

Use Eden AI’s Responses endpoint directly with the OpenAI Python SDK:
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_EDEN_AI_API_KEY",
    base_url="https://api.edenai.run/v3/llm"
)

response = client.responses.create(
    model="anthropic/claude-sonnet-4-5",
    input="What is the capital of France?",
    instructions="You are a helpful assistant."
)

print(response.output[0].content[0].text)
For multi-turn with the SDK:
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_EDEN_AI_API_KEY",
    base_url="https://api.edenai.run/v3/llm"
)

res1 = client.responses.create(
    model="openai/gpt-4o",
    input="What is the capital of France?",
    store=True
)

res2 = client.responses.create(
    model="openai/gpt-4o",
    input="What is its population?",
    previous_response_id=res1.id
)

print(res2.output[0].content[0].text)

Streaming

Set stream: true to receive output incrementally as Server-Sent Events. See Streaming for the full SSE format and parsing examples.

Next Steps

Chat Completions

Use the stateless chat completions endpoint

Streaming

Receive responses token by token via SSE

Tools

Extend responses with function calling and built-in tools

Structured Output

Constrain responses to a JSON schema