Under heavy development
StitchAPI
Surfaces

In-process function

Call a stitch directly as a typed async function, awaited or streamed.

A stitch is a typed async function — no server, no transport. await it for the final unwrapped, validated value, or iterate its event stream for everything that happened on the way there. This is the closest of the four surfaces: the same definition you call here also runs from the CLI, over HTTP, and through MCP.

Example

import {  } from 'stitchapi';

const  = <{ : number; : string }>({
    : 'https://api.example.com',
    : '/users/{id}',
});

// Await it for just the value…
const  = await ({ : { : 1 } });

// …or iterate the typed event stream for everything that happened.
for await (const  of .({ : { : 1 } })) {
    if (. === 'result') .(.);
}

Options

Awaited vs streamed. await getUser(input) resolves to the final value, already unwrapped and validated. getUser.stream(input) yields the typed event streamstart → progress → drift → result → done — so you can observe retries, throttling, and drift as they happen. Same call, two altitudes.

Pre-binding input. getUser.with(partial) returns a new stitch with part of the input baked in, so a shared header or a fixed path param is set once and reused across calls. See .with() partial application.

One definition, four surfaces. The in-process function is one surface over a single definition. The same stitch is reachable from the CLI, served over HTTP, and exposed to agents through MCP — nothing about the definition changes.

Calling the stitch returns a result you can both await and .stream(); getUser.stream(input) is shorthand for streaming that same result.

See also

On this page