Release candidate — 1.0.0-rc.6
Agent-native runtime

Turn any REST, GraphQL, SSE, or LLM API into a typed, resilient function.

Declare an external API once; call it like a function, the network out of sight. That same definition is a tool an AI agent can call — and it inherits the whole runtime: retries, streaming, and responses trimmed to the fields that matter, so they spend far fewer tokens — never the credential, only the capability.

No infraNo config filesNo scaffoldingZero depsRuns everywhere
users.ts
import { stitch } from 'stitchapi';
import { z } from 'zod';

const User = z.object({ id: z.string(), name: z.string() });

// Declare once — types, validation, resilience.
const getUser = stitch({
  path: 'https://demo.stitchapi.dev/users/{id}',
  output: User, // validator of your choice
  retry: 3,
  timeout: '5s',
  cache: '1m',
});

// Call it like a local function.
const user = await getUser({ params: { id: '42' } });
// → typed · validated · retried · cached
See it run

Twenty seconds, four guarantees

A reply streams in token by token, the output is validated with drift logged, a 502 recovers on its own, and an agent calls the same stitch as a tool.

Watch more

Built for agents, not bolted on

When the caller is an agent, it inherits the whole runtime

A hand-wrapped MCP tool forwards raw bytes and a stored key. The same stitch hands an agent a production runtime — and never the secret behind it.

Responses sized for context

Output comes back unwrapped, validated, and trimmed to the fields you declared — the model reads structured data, not an 8 KB raw payload. Fewer tokens, less noise.

Streaming it can act on

Typed start → progress → drift → result events stream back, so an agent reacts to partial results instead of blocking on opaque bytes.

Resilience off the prompt

Retries with backoff, throttling, and timeouts are the runtime’s job, not the model’s — reliability never has to live in the reasoning.

A capability, not a credential

Auth lives at the stitch. The agent invokes it and receives data, never the token behind it — safe to hand to a caller you don’t fully trust.

0runtime deps

Built on the platform’s global fetch — nothing to install, nothing to audit, nothing in your transitive tree.

~25 kBmin + gzip

The whole stitchapi entry, tree-shaken — and it is an enforced budget in CI, not an aspiration.

~20 kBimport { stitch }

Pay only for what you import: every surface beyond http lives behind its own subpath, so the core trims down.

What you'd otherwise hand-roll

fetch hands you bytes. Everything that makes it reliable, you write yourself.

A stitch folds it into the call — validation, retries, timeouts, throttling, drift, and traces — declared once and uniform across every endpoint, so you stop re-solving them per integration.

Around raw fetch, you hand-roll…
Opaque bytes you parse and hope are the right shape
Schema-validated, typed results — drift caught on every call
A throw on the first failure, then it is on you
Retries with backoff + jitter, honoring Retry-After
One coarse timeout, if you remember it
Layered total / per-attempt / chunk timeouts with real aborts
No rate control — you meet the 429s in production
Proactive throttle: rate + concurrency caps, shared per host
A raw byte stream you frame and paginate yourself
SSE framing, delta concatenation, auto-pagination, resumability
Zero visibility into what the call did
A typed event stream + opt-in traces: latency, retries, drift
What you get at the call site

Everything fetch left to you — declared, defaulted, and observable

Progressive disclosure: stitch('https://…') just works, and every capability reveals its knobs only when you reach for them.

Runtime drift detection

Every response is validated against its contract, so a vendor silently renaming a field surfaces immediately — not hours later as a downstream undefined.

Validation, then re-prompt

Schemas guard params, query, body, and output. On a mismatch the stitch can re-prompt instead of handing garbage back to a model.

Reliability built in

Retries with backoff + jitter, Retry-After, idempotency keys, throttling, and circuit breaking — declared per stitch, not bolted on.

Layered timeouts

Total, step, and chunk timeouts plus AbortSignal, so a slow upstream never quietly hangs your call.

The event stream is the spine

start → progress → drift → result → done. Streaming output, observability, and drift all read the same stream a stitch emits.

Capability, not credential

Auth lives at the stitch. Callers — including agents — get data without ever seeing the secret behind it.

Compose, don’t configure

baseUrl, auth, retry, throttle, and hooks are named, shareable values you compose with .with() and extends — no central config object.

Observable by default

gen_ai.* and mcp.* spans carry tokens, cost, and latency, turning the agent-native layer into your integration-health layer.

Scope

What StitchAPI is not

Knowing what a tool refuses to be is how you trust what it is. StitchAPI holds a hard line on scope.

Not an HTTP client or fetch replacement

fetch and axios are the substrate underneath — bring your own adapter. A stitch sits above the transport and turns an endpoint into a function; it never reimplements the call.

Not a code generator

There's no SDK to commit, diff, and regenerate. The declaration is the runtime, validated live on every call — so it can't fall out of date with the API.

Not spec-first

No OpenAPI document required. A URL and one example response is enough — so it reaches the internal and undocumented long tail codegen never covers.

Not a server to deploy

Nothing to run or operate, and you don't own both ends. It's a zero-dependency library you import — for the APIs you don't control.

Not a workflow engine or iPaaS

No orchestration, queues, or visual builder. Composition is plain TypeScript; the stitch is the boundary and nothing more.

No config files or hidden inheritance

Nothing ambient or global a stitch silently reads — everything that shapes a call is composed in explicitly. Read one stitch and you know exactly what it does.

No server, no codegen, no config files, no implicit inheritance — only explicit composition.

Two empty quadrants

Built for the two quadrants nobody else covers

tRPC-grade ergonomics for the APIs you don’t own — declared once, called like a local function. These are the two gaps every other approach leaves open.

Spec-less long tail

Every serious competitor needs an OpenAPI spec. A stitch needs one endpoint — or one example. Author from the response you already have.

Heterogeneous & agent-native

A lightweight library where HTTP, GraphQL, shell, and LLM are symmetric, declared primitives — kind-agnostic today, composable into bigger stitches tomorrow.

Stitch your first API. Start with one endpoint.

Declare your first stitch and call it as a typed function in five minutes — then reach the same definition from the CLI, HTTP, or an agent.