Skip to main content
Invoke a Profy Expert (AI Agent) and receive a complete response via SSE streaming, including text output, tool calls, and token usage.

Authentication

string
required
Bearer sk-pro-xxxx (API Key) or Bearer <access_token> (OAuth)

Request Body

string
required
The Expert’s unique identifier. You can find it on the Expert’s marketplace page or in Studio.
string
required
The message content to send to the Expert.
string
Session ID for multi-turn conversations. Not required for the first call — a new session_id is returned in the X-Session-Id response header.
string
Specify the model to use. Defaults to the platform’s default model if not provided. Use GET /v1/models to query available models.
string[]
File ids to attach, up to 20. Ids come from Upload File. The platform materializes each file in the Expert’s sandbox (/home/user/uploads/), where the Expert can read / grep it.Ids only, never URLs: the platform will not fetch a link you hand it, so you never have to publish a readable link to a private document.

Request Examples

Response Format

The response is an SSE (Server-Sent Events) stream with hierarchical dot-notation event names (aligned with the OpenAI Responses API). The response headers include X-Session-Id for subsequent multi-turn conversations.

SSE Event Types

Lifecycle Events

Output Events

Tool Call Events

Usage Events

Streaming Examples

Billing

Billed by token usage (billing unit token_split). Credits are deducted from the account that owns the API Key, not from the end user named in X-End-User-Id — that header only scopes sessions and attributes usage; it is not a billing subject. Formula: ceil(input_tokens × input_rate ÷ 1e6) + ceil(output_tokens × output_rate ÷ 1e6) (input and output are rounded up separately, then summed). Per-model rates are operational data, so read the current values from the model selector or the model list endpoint; the algorithm is fixed and documented in Billing Formulas. Read actual consumption for a call from the usage.token event — that is the authoritative value. Do not estimate with your own tokenizer and treat the result as a bill.

Error Codes

Next Steps

Upload File

Give the Expert a document to read

Chat Completions

OpenAI-compatible chat completions endpoint

Python SDK

Complete Python SDK guide