Skip to main content
@profy-ai/sdk is the official TypeScript SDK for the Profy platform. It uses the native fetch API and supports both Node.js and browser environments.

Installation

Requires Node.js 18+ (native fetch support needed).

Quick Start

Client Configuration

Resource Namespaces

Agents

agents.run() — Invoke an Expert

AgentRunResult type definition:

agents.runStream() — Stream an Expert Invocation

AgentRunChunk type definition:

Chat Completions

chat.completions.create() — Chat Completion

Non-streaming (returns ChatResponse):
Streaming (returns AsyncGenerator<ChatChunk>):
The SDK uses TypeScript function overloads for type safety:

Models

models.list() — Get Model List

Events

events.report() — Report a Custom Event

The Events API only supports OAuth Tokens. Calling with an API Key will return a 401 error.

Error Handling

The SDK throws ProfyApiError when the API returns a non-2xx status code:

Timeout Handling

agents.run() will attempt to return partial results already received on timeout (result.partial = true).

Browser Environment

The SDK uses native fetch and works in the browser:
Do not use API Keys in browser frontend code. Use OAuth Tokens on the browser side. API Keys should only be used in Node.js server-side code.

Full Example: Express API Proxy

Full Example: Multi-Turn Conversation

Next Steps

Python SDK

Python SDK guide

API Reference

Complete API documentation