---
title: "Generate"
method: POST
path: "/generate"
tags: ["Inference"]
---

# Generate

`POST /generate`

Generate text based on the input prompt.

## Request body

- GenerateRequest
  - `prompt` object[], required — The input prompt for the language model to generate text from.
  - `min_output_tokens` integer — Minimum number of tokens to output.
  - `max_output_tokens` integer — Maximum number of tokens to output.
  - `topk` integer — Choose top k tokens.
  - `model` string — The name of the model or adapter to use for generation.
  - `stream` boolean, nullable — Whether to stream the response back incrementally.
  - `tools` object[], nullable — List of tools given to model.
  - `tool_choice` string, nullable — Controls which (if any) tool is called by the model.
  - `logprobs` boolean — Whether to return log probabilities of the output tokens or not.
  - `top_logprobs` integer — Return output tokens with top probabilities.
  - `system_prompt_version` string — Which system prompt to use in the backend.
  - `tool_name` string — Which tool was selected by router LLM model.
  - `context_for_tool` string — Context most relavant to selected tool.
  - `guided_json` object, nullable — A JSON schema for guided generation.
  - `guided_regex` string, nullable — A regex pattern for guided generation.
  - `response_format` object, nullable — For JSON object output.
  - `metadata` object, nullable — Used to propagate number of prefill and decode tokens.
  - `echo` boolean — Echo back the prompt in addition to the completion.
  - `stream_options` StreamOptions
    - `include_usage` boolean, nullable
    - `include_obfuscation` boolean, nullable
  - `stop` union — Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
    - string[]
    - string
  - `temperature` number, nullable — What sampling temperature to use, between 0 and 2.
  - `ignore_eos` boolean — Ignore end of sequence (stop_id) and continue generation until output limit is hit.

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/taalas/apis/taalas-api.md) · [All operations](https://skmtc.net/taalas/apis/taalas-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/taalas/taalas-api/versions/494a915c542e/schema)
