Skip to main content
POST
/
api
/
chat
/
generate
cURL
curl --request POST \
  --url https://recoup-api.vercel.app/api/chat/generate \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "prompt": "<string>",
  "messages": [
    {
      "id": "<string>",
      "role": "user",
      "content": "<string>"
    }
  ],
  "artistId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "model": "openai/gpt-5-mini",
  "excludeTools": [
    "create_scheduled_actions"
  ],
  "roomId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "topic": "<string>"
}
'
{
  "text": [
    {
      "type": "text",
      "text": "<string>"
    }
  ],
  "reasoningText": "<string>",
  "sources": [
    {}
  ],
  "finishReason": "stop",
  "usage": {
    "inputTokens": 123,
    "outputTokens": 123,
    "totalTokens": 123,
    "reasoningTokens": 123,
    "cachedInputTokens": 123
  },
  "response": {
    "messages": [
      {}
    ],
    "headers": {},
    "body": {}
  }
}

Authorizations

x-api-key
string
header
required

Your Recoup API key. Learn more.

Body

application/json

Chat generation request

Request body for chat generation. Exactly one of 'prompt' or 'messages' must be provided.

prompt
string

Single text prompt for the assistant. Required if 'messages' is not provided.

messages
object[]

Array of UIMessage objects for context. Required if 'prompt' is not provided.

artistId
string<uuid>

The unique identifier of the artist (optional)

model
string

The AI model to use for text generation (optional)

Example:

"openai/gpt-5-mini"

excludeTools
string[]

Array of tool names to exclude from execution

Example:
["create_scheduled_actions"]
roomId
string<uuid>

UUID of the chat room. If not provided, one will be generated automatically.

topic
string

Topic name for the new chat room (e.g., 'Pulse Feb 2'). Only applies when creating a new room - ignored if room already exists. To edit the topic of an existing room, use PATCH /api/chats.

Response

Chat generated successfully

Response from the chat generation endpoint

text
object[]

Array of content parts from the AI model response

reasoningText
string | null

Optional reasoning or explanation for the response

sources
object[]

Optional array of sources used for the response

finishReason
string

The reason why the generation finished

Example:

"stop"

usage
object

Token usage information

response
object

Additional response metadata