context.call, you can also make third‑party requests using the context.api namespace.
This namespace provides built‑in integrations for OpenAI, Anthropic, and Resend, allowing you to make requests in a type‑safe manner.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
context.call, you can also make third‑party requests using the context.api namespace.
This namespace provides built‑in integrations for OpenAI, Anthropic, and Resend, allowing you to make requests in a type‑safe manner.
const { status, body } = await context.api.openai.call("Call OpenAI", {
token: "<OPENAI_API_KEY>",
operation: "chat.completions.create",
body: {
model: "gpt-4o",
messages: [
{
role: "system",
content: "Assistant says 'hello!'",
},
{ role: "user", content: "User shouts back 'hi!'" },
],
},
});
const { status, body } = await context.api.anthropic.call(
"Call Anthropic",
{
token: "<ANTHROPIC_API_KEY>",
operation: "messages.create",
body: {
model: "claude-3-5-sonnet-20241022",
max_tokens: 1024,
messages: [
{"role": "user", "content": "Hello, world"}
]
},
}
);
const { status, body } = await context.api.resend.call("Call Resend", {
token: "<RESEND_API_KEY>",
body: {
from: "Acme <onboarding@resend.dev>",
to: ["delivered@resend.dev"],
subject: "Hello World",
html: "<p>It works!</p>",
},
headers: {
"content-type": "application/json",
},
});
Was this page helpful?