---
title: "Generate text from session context"
method: POST
path: "/api/session/{sessionID}/generate"
tags: ["session"]
---

# Generate text from session context

`POST /api/session/{sessionID}/generate`

## Request

- Base URL: `https://opencode.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://opencode.ai/api/session/{sessionID}/generate`
- Auth: none required

Generate transient text from the current session context without mutating session history.

## Path parameters

- `sessionID` string, required

## Request body

- object
  - `prompt` string, required

## Response `200`

SessionGenerateResponse

- SessionGenerateResponse
  - `data` object, required
    - `text` string, required

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `404`: SessionNotFoundError | LocationNotFoundError
- `503`: ServiceUnavailableError

---

[API](https://skmtc.dev/kaaass/apis/opencode.md) - [All operations](https://skmtc.dev/kaaass/apis/opencode/llms.txt) - [OpenAPI document](https://skmtc.dev/kaaass/apis/opencode/revisions/4e083d954707?raw)
