---
title: "Generate text (deprecated path)"
method: POST
path: "/api/experimental/generate"
tags: ["generate"]
deprecated: true
---

# Generate text (deprecated path)

`POST /api/experimental/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/experimental/generate`
- Auth: none required

> **Deprecated.**

Deprecated alias of POST /api/experimental/generate/text.

## Request body

- object
  - `prompt` string, required
  - `model` ModelRef
    - `id` string, required
    - `providerID` string, required
    - `variant` string

## Response `200`

GenerateTextResponse

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

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `404`: ProviderNotFoundError | ModelNotFoundError | LocationNotFoundError
- `422`: UnsupportedModelError
- `502`: ProviderRequestError
- `503`: ServiceUnavailableError

## Changes

> 50 revisions in range; 1 not diffed.

- **2026-10-27** `d6d739fceba2`: 4 breaking, 5 info
  - the response's body type changed from `object` to no type for status `404`
  - removed the required property `_tag` from the response with the `404` status
  - removed the required property `location` from the response with the `404` status
  - removed the required property `message` from the response with the `404` status
  - …5 more

[Operation history](https://skmtc.dev/kaaass/apis/opencode/changes/api/experimental/generate/post.md)

---

[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)
