Skip to content
Sign In Get Started

Responses API

POST https://api.floopy.ai/v1/responses accepts the native OpenAI Responses format. Choose responses.create when you need Responses items, reasoning with function tools, or typed streaming events. Existing Chat Completions calls continue to use /v1/chat/completions.

import { Floopy } from "floopy-sdk";
const floopy = new Floopy({
apiKey: process.env.FLOOPY_API_KEY!,
options: { llmSecurityEnabled: true },
});
const response = await floopy.responses.create({
model: "gpt-6-luna",
input: "Explain how an AI gateway works.",
reasoning: { effort: "medium" },
store: false,
});
console.log(response.output_text);

Authentication uses your Floopy API key. The organization configures its OpenAI provider credential in Floopy. The official OpenAI client also works with baseURL: "https://api.floopy.ai/v1".

Responses runs through the same orchestration as Chat Completions: API key and plan validation, rate limits, model overrides, prompt resolution and templates, routing strategies, experiments, Smart Cost and feedback routing, firewall, guardrails, retries, circuit breakers, fallback, usage and cost logging, and session reconstruction. The existing Floopy-* headers apply. The LLM firewall requires both the plan feature and floopy-llm-security-enabled: true.

Initially, native Responses targets OpenAI. Routing and fallback consider compatible OpenAI targets; incompatible providers are skipped. A request with no compatible target fails explicitly. Choosing Responses does not bypass model selection, and the gateway does not silently disable reasoning. Chat Completions remains the multi-provider compatibility endpoint.

FieldPurpose
modelModel or existing Floopy model fallback list; routing rules and model overrides still apply
inputString or native input items, including messages, images, files, reasoning and function call results
instructionsInstructions inspected by the firewall and combined with configured prompts
reasoning.effortNative reasoning setting, preserved without forced changes
tools, tool_choiceNative tools and function selection; function definitions use the flat Responses shape
text.formatNative output format, including JSON schemas
max_output_tokensOutput token limit
streamNative typed SSE events
storeOpenAI response persistence; explicitly use false for stateless calls
previous_response_id, conversationProvider-managed history, inspected before firewall and routing
inputsFloopy prompt template variables; removed before the provider call

Native output is returned with object: "response", output items and usage.input_tokens / usage.output_tokens, including cached and reasoning token details. Unknown native fields are preserved. Model support and upstream validation still apply to each native capability.

const response = await floopy.responses.create({
model: "gpt-6-luna",
input: "What is the weather in Fortaleza?",
reasoning: { effort: "medium" },
tools: [{
type: "function",
name: "get_weather",
description: "Get the weather for a city",
strict: false,
parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] },
}],
store: false,
});
for (const item of response.output) {
if (item.type === "function_call") console.log(item.name, item.arguments, item.call_id);
}

For client-managed tool execution, replay the returned output items (including reasoning items) together with your function_call_output. When the Floopy MCP agent is enabled, its existing tool loop continues through the same orchestration and returns Responses output.

const stream = await floopy.responses.create({
model: "gpt-6-luna", input: "Tell a short story.", stream: true, store: false,
});
for await (const event of stream) {
if (event.type === "response.output_text.delta") process.stdout.write(event.delta);
}

The gateway preserves upstream events such as response.created, response.output_text.delta, function argument deltas, and terminal response.completed / response.incomplete. Usage is recorded after the terminal event. An interrupted stream is logged as a failure.

Use previous_response_id or conversation, never both. The gateway retrieves referenced history with the organization’s OpenAI credential before inspection. Model selection and fallback still apply within compatible OpenAI targets; the selected model must support the referenced native items. History inspection is bounded to 10 MiB and 30 seconds and fails explicitly if history cannot be resolved.

Caching is eligible only for text-only requests with store: false, no tools and no provider-managed history. Native request fields participate in cache keys, and Responses has a separate cache namespace from Chat Completions. Cached response IDs cannot be used as persisted OpenAI history.

This release supports synchronous creation and SSE streaming. background: true is rejected because asynchronous jobs need separate usage accounting. Public retrieval, cancellation, deletion and conversation-management routes are not exposed by the gateway yet, even though upstream SDKs expose those methods.

from floopy import Floopy
import os
with Floopy(api_key=os.environ["FLOOPY_API_KEY"]) as client:
response = client.responses.create(model="gpt-6-luna", input="Hello!", store=False)
print(response.output_text)
# AsyncFloopy exposes the same client.responses surface.
import (
"context"
"os"
floopy "github.com/FloopyAI/floopy-go"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
client, err := floopy.NewClient(os.Getenv("FLOOPY_API_KEY"))
if err != nil { panic(err) }
response, err := client.Responses().New(context.Background(), responses.ResponseNewParams{
Model: "gpt-6-luna",
Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("Hello!")},
})
if err != nil { panic(err) }
println(response.OutputText())
use floopy::Floopy;
use floopy::async_openai::types::responses::CreateResponse;
let client = Floopy::new(std::env::var("FLOOPY_API_KEY")?)?;
let request: CreateResponse = serde_json::from_value(serde_json::json!({
"model": "gpt-6-luna", "input": "Hello!", "store": false
}))?;
let response = client.responses().create(request).await?;
println!("{}", response.id);

The updated SDKs use OpenAI Node 7.28+, Python 3.25+, Go v3.72+ (Go 1.25+), and Rust async-openai 0.42.1+.