Seven tools, fully typed.
One package. Schemas + handler.
Import the schemas to declare the tool surface to OpenAI. Import the handler to actually execute the tool calls against /v1/send. Stateful idempotency keys, per-tool error mapping, and observability are baked in.
- Schemas exported as plain JSON-Schema
- Handler returns standard tool-output objects
- Per-tool error code mapping to OpenAI's tool_error contract
- Idempotency keys propagated end-to-end
- Works in serverless (Vercel, Cloudflare Workers)
import { SENDDIO_TOOLS, handleToolCall } from '@senddio/openai-tools';
// Pass these Chat Completions-style schemas to your model integration.
const tools = [...SENDDIO_TOOLS];
// When your model returns a function tool call:
async function executeSenddioTool(call) {
const output = await handleToolCall(
call.function.name,
JSON.parse(call.function.arguments),
{ apiKey: process.env.SENDDIO_API_KEY }
);
// Return this tool result to the model in your application's loop.
return { tool_call_id: call.id, output };
}Your first 30 days as an assistant-driven product.
OpenAI tools — FAQ
They run in your code. The cleanest pattern is to import the @senddio/openai-tools package, pass the schemas to the Assistants API's tools array, and use the included handler to forward each tool call to Senddio. You wire it up once.
Yes. The schemas are plain JSON Schema, so they work with both the modern Responses API and the older ChatCompletion function-calling style. The package exports Chat Completions-style schemas; adapt their envelope when using the Responses API.
You can, but we recommend giving each assistant its own agent-scoped key. That way your audit trail clearly shows which assistant sent which message. Same endpoint, different keys, much cleaner reporting.
The handler is asynchronous and returns a JSON string. OpenAI's streaming model orchestrates the interleaving on its side. Your application awaits execution and returns the result to the model.