Skip to main content
POST
General Chat API
  • Unified chat API interface for most LLMs; see LLM Models for which models support it
  • Select different AI models via the model parameter
  • Compatible with OpenAI Chat Completions API format

Usage Examples

Basic Conversation

System Prompt

Multi-turn Conversation

Streaming Output

Notes

  • Use stream: true for SSE streaming responses.
  • Different models may support different context lengths, output limits, and optional parameters.
  • For new OpenAI-compatible workflows that need tools or multimodal structured input, use the Responses API.

Response

Non-streaming requests return the Chat Completions object directly, without a code / data wrapper. Reasoning models such as DeepSeek also return their reasoning text in choices[].message.reasoning_content, and count it in usage.completion_tokens_details.reasoning_tokens.

Streaming

With "stream": true, the response is text/event-stream. Each event is a data: line with a chat.completion.chunk object, and the stream ends with data: [DONE]:
  • Text arrives in choices[0].delta.content. Reasoning models stream choices[0].delta.reasoning_content first.
  • The last chunk carries finish_reason and usage.

Errors

  • 401: missing or invalid API key.
  • 400: invalid parameters, or the model does not support Chat Completions (for example gpt-5-6-sol, which only supports Responses). The message lists the supported URIs.
  • 404: unknown model id.
See Error Codes for example bodies, and LLM Models for which models support this format.

Authorizations

Authorization
string
header
required

All API endpoints require Bearer Token authentication.

Create an API key: sign in to PoYo, open Dashboard → API Key at poyo.ai/dashboard/api-key, and click to create a key.

Add it to the request header:

Body

application/json
model
string
required

Model name. Example: gpt-5.2, claude-sonnet-4-5-20250929, gemini-3-flash-preview.

Example:

"gpt-5.2"

messages
object[]
required

List of conversation messages. Each message contains a role and content. Use system to define model behavior, user for user input, and assistant for previous model responses in multi-turn conversations. Example: [{"role": "user", "content": "Explain vector databases in one sentence."}].

temperature
number

Controls output randomness, range 0-2. Lower values such as 0.2 make output more deterministic. Higher values such as 1.8 make output more random. Default: 1.0.

Required range: 0 <= x <= 2
Example:

1

max_tokens
integer

Maximum number of tokens to generate. Different models have different maximum limits.

Required range: x >= 1
Example:

256

stream
boolean

Whether to use streaming output. true returns a streaming response in SSE format. false returns the complete response at once. Default: false.

Example:

false

top_p
number

Nucleus sampling parameter, range 0-1. Controls diversity of generated text. We recommend using either top_p or temperature, not both. Default: 1.0.

Required range: 0 <= x <= 1
Example:

1

frequency_penalty
number

Frequency penalty, range -2.0 to 2.0. Positive values reduce the likelihood of repeating the same words. Default: 0.

Required range: -2 <= x <= 2
Example:

0

presence_penalty
number

Presence penalty, range -2.0 to 2.0. Positive values increase the likelihood of talking about new topics. Default: 0.

Required range: -2 <= x <= 2
Example:

0

stop

Stop sequences. Up to 4 sequences where generation will stop when encountered.

Example:

"\n\nHuman:"

n
integer

Number of completions to generate. Default: 1. Must be a plain number such as 1; do not use quotes.

Required range: x >= 1
Example:

1

Response

Completion created

id
string

Unique identifier for the response.

Example:

"chatcmpl-9876543210"

object
string

Object type.

Example:

"chat.completion"

created
integer

Creation timestamp.

Example:

1677652288

model
string

The actual model name used.

Example:

"gpt-5.2"

choices
object[]
usage
object