Five 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 OpenAI from 'openai';
import { tools, handleToolCall } from '@senddio/openai-tools';
const openai = new OpenAI();
const run = await openai.beta.threads.runs.create(threadId, {
assistant_id: ASSISTANT_ID,
tools, // ← our schemas
additional_instructions: 'You may send messages.'
});
// When run.required_action arrives:
for (const call of run.required_action.submit_tool_outputs.tool_calls) {
const output = await handleToolCall(call, {
apiKey: process.env.SENDDIO_API_KEY,
agent: 'gpt-4-shipping-bot'
});
await openai.beta.threads.runs.submitToolOutputs(threadId, run.id, {
tool_outputs: [{ tool_call_id: call.id, output }],
});
}Assistants that actually ship.
Composite quotes from teams putting GPT assistants in front of real users.
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. We test against the latest GPT model families.
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 a simple synchronous call and return. OpenAI's streaming model orchestrates the interleaving on its side. Senddio does not add latency to the response stream.