@fetch-hive/sdk package when you want to invoke a prompt deployment from Node.js or TypeScript. The SDK wraps the public POST /v1/prompt/invoke endpoint with a typed client, handles authentication, and exposes streaming as an AsyncIterable.
Installation
fetch) and ships with TypeScript types out of the box.
Authentication
Set theFETCH_HIVE_API_KEY environment variable to your workspace API key:
Basic example
Invoke a prompt deployment and read the final response:invokePrompt returns a Promise that resolves to the parsed JSON body once the prompt has completed. See the non-streaming response shape.
Method reference
| Field | Type | Required | Description |
|---|---|---|---|
deployment | string | Yes | The prompt deployment name |
variant | string | No | The deployment variant name |
inputs | Record<string, unknown> | No | Key-value pairs for the prompt variables |
user | string | No | Opaque caller identifier surfaced in User Tracking |
metadata | Record<string, string | number | boolean | null> | No | Flat caller-defined metadata for audit and log filtering. See Invoke metadata |
streaming: false for invokePrompt. To stream, use invokePromptStream (below).
Handling the response
Streaming
UseinvokePromptStream to receive Server-Sent Events as they arrive. The method returns an AsyncIterable that you can consume with for await:
reasoning, response, a final usage event, or an error event if the provider fails mid-stream.
Configuration
| Option | Default | Description |
|---|---|---|
apiKey | process.env.FETCH_HIVE_API_KEY | Bearer token from the dashboard |
baseURL | https://api.fetchhive.com/v1 | Override the API base URL |
Errors
Non-2xx responses throw anError whose message includes the status code and response body:
Links
Next steps
- Run with API - The same flow with cURL
- Run with Python SDK
- Run with Ruby SDK
- Run with PHP SDK
- Invoke Prompt - Full endpoint reference

