createClient
Returns a typed RPC client whose properties invoke backend methods by their export name.
createClient<T>() → Client<T>
Call a backend method as api.methodName(input), using its camelCase export name; the call resolves with the method's return value and throws a MindStudioInterfaceError on failure. Pass a type parameter to get fully typed inputs and outputs, or omit it and every method accepts any and resolves to any. For a long-running method, pass InvokeOptions as the second argument to stream its output.
Create a client and call a method
import { createClient } from '@mindstudio-ai/interface'; const api = createClient<{ listVendors(): Promise<{ vendors: Vendor[] }>; }>(); const { vendors } = await api.listVendors(); // Streaming: pass { stream: true } and an onToken callback await api.enrichProfile({ name }, { stream: true, onToken: (text) => setText(text) });