Terminal

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST

Create terminal ai

Stream a terminal model response through PostHog AI. Requires organization approval for AI data processing. SDK consumers must use getTerminalAiCreateUrl() with streaming fetch. The generated JSON client buffers the response and cannot parse SSE.

Required API key scopes

conversation:write

Query parameters

  • format
    string
    One of: "json""txt"

Request parameters

  • model
  • messages
    Click to open
    array
  • max_tokens
    integer
  • stream
    boolean
    Default: true
  • system
  • tools
    Click to open
    array
  • temperature

Example request

POST /api/projects/:project_id/terminal_ai
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/terminal_ai/\
-d model=undefined,\
-d messages="array",\
-d max_tokens="integer"

Example response

Status 200