ShapelessAI← Back
Interfaces

Vercel AI SDK

The shapelessai-ai-sdk package: list connected accounts, schedule or publish a post, and read post status as AI SDK tools, with approval before anything goes out.

Verified
View as Markdown

shapelessai-ai-sdk is a set of Vercel AI SDK tools: drop them into generateText or streamText and the model can read the social accounts you connected, schedule or publish a post on one of them, and check what went live. It calls the same API every other door does, with an API key.

Install

npm install shapelessai-ai-sdk ai

Node 18 or newer. ai 6 or newer and zod 3.25 or 4 are peer dependencies. Source: github.com/FirstClassTree/shapelessai, integrations/ai-sdk.

Set the key

Mint a key under Settings, API keys with the read and publish scopes (Authentication), and set it as SHAPELESSAI_API_KEY. Every factory also takes { apiKey } directly.

Use the tools

import { generateText, isStepCount } from "ai";
import { shapelessaiTools } from "shapelessai-ai-sdk";

const { text } = await generateText({
  model: "openai/gpt-5-mini",
  prompt: 'Schedule "We just shipped dark mode" to my LinkedIn in the next free slot.',
  tools: shapelessaiTools(),
  stopWhen: isStepCount(5),
});
ToolWhat it doesInput
listAccountsThe connected accounts a post can go to, with the connectionId the other tools take. Call it first.platform? (for example "linkedin")
createPostA post on one account: the account's next free queue slot by default, a set time with scheduledAt, or right away with publishNow.connectionId, text, scheduledAt? (ISO 8601), publishNow?
listPostsRecent posts with status, scheduled time, the live URL once published, and the error when one failed.status?, limit? (1 to 50, default 20)

Each tool is also exported on its own (listAccounts(), createPost(), listPosts()), so an agent that only reads can carry only the readers. Every factory takes { apiKey, baseURL, needsApproval }.

Approval before a post

createPost ships with needsApproval: true: the AI SDK pauses before the tool runs and your app decides whether the post goes ahead, the same gate the hosted MCP server puts in front of every tool that publishes. Pass createPost({ needsApproval: false }) for an agent that is allowed to post on its own, for example one that only ever queues.

A post with no time and no publishNow takes the next free queue slot on purpose: nothing goes out at an odd hour because the model left a field blank. The queue, the timings and every refusal the rail can answer with are on Posts.

What comes back

createPost answers { id, status, scheduledAt, url, error }: status is scheduled for a queued or timed post, published with a url for one that went out now. listPosts answers the same shape per post, plus connectionId, platform, text and publishedAt.

A refused key answers an error that names where to mint a new one. A platform rule the post breaks answers the rule itself (Platforms). On the Free plan the eleventh post of a UTC day answers the day that is full (Posts).

Questions

Does the AI SDK integration cover the whole API?

No. It carries the three tools an agent in an app needs most: accounts, create a post, read posts. Everything else, from media generation to jobs and Brand Memory, is one fetch away on the API, or every tool at once on the hosted MCP server.

Which models does it work with?

Any model the AI SDK can call tools with. The tools are plain tool() definitions with Zod input schemas; the example above uses the AI Gateway model string, and a provider model works the same way.