---
title: "POST /projects/{project_id}/ai/structured-output/stream"
method: POST
path: "/projects/{project_id}/ai/structured-output/stream"
tags: ["AI Gateway"]
---

# POST /projects/{project_id}/ai/structured-output/stream

`POST /projects/{project_id}/ai/structured-output/stream`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/ai/structured-output/stream`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required

## Request body

- StreamStructuredOutputRequest
  - `cache_key` string, nullable: Optional screen-owned cache identity. Prompt and schema hashes are also included automatically, preventing stale output when input data changes.
  - `cache_ttl_seconds` integer, nullable: Backend cache lifetime in seconds (default 60, clamped to 1-300).
  - `model` string, nullable: Optional enabled model id for the selected key.
  - `prompt` string, required: The complete, already-authorized context and instructions for the model.
  - `provider_key_id` integer, nullable: Optional configured gateway key. Omit to use the active gateway key. Host subscription CLIs are intentionally not accepted here.
  - `purpose` string, required: Stable product use-case identifier, for example `api_traffic.summary`.
  - `refresh` boolean: Bypass any matching backend cache entry and replace it with this result.
  - `schema` unknown, required
  - `thinking_level` string, nullable: Optional normalized reasoning depth advertised for the selected model.

## Response `200`

SSE events: started, partial, complete, or error

## Other responses

- `400`: Invalid prompt or JSON Schema
- `401`: Unauthorized
- `403`: Insufficient permissions
- `409`: No active AI provider

## Changes

- **2026-09-07** `2b95ed4ff1d2`: 1 info
  - endpoint added
- **2026-09-07** `f7404eb7ac98`: 1 breaking
  - api path removed without deprecation
- **2026-08-14** `5b69d84f67d1`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/ai/structured-output/stream/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
