curl --request POST \
--url https://api.poyo.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-5.2",
"messages": [
{
"role": "system",
"content": "You are a structured output assistant. Reply with JSON only."
},
{
"role": "user",
"content": "Generate a paginated list response example with fields items, page, page_size, total and sample values."
}
]
}
'import requests
url = "https://api.poyo.ai/v1/chat/completions"
payload = {
"model": "gpt-5.2",
"messages": [
{
"role": "system",
"content": "You are a structured output assistant. Reply with JSON only."
},
{
"role": "user",
"content": "Generate a paginated list response example with fields items, page, page_size, total and sample values."
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-5.2',
messages: [
{
role: 'system',
content: 'You are a structured output assistant. Reply with JSON only.'
},
{
role: 'user',
content: 'Generate a paginated list response example with fields items, page, page_size, total and sample values.'
}
]
})
};
fetch('https://api.poyo.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.poyo.ai/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-5.2',
'messages' => [
[
'role' => 'system',
'content' => 'You are a structured output assistant. Reply with JSON only.'
],
[
'role' => 'user',
'content' => 'Generate a paginated list response example with fields items, page, page_size, total and sample values.'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.poyo.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"gpt-5.2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a structured output assistant. Reply with JSON only.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Generate a paginated list response example with fields items, page, page_size, total and sample values.\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.poyo.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-5.2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a structured output assistant. Reply with JSON only.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Generate a paginated list response example with fields items, page, page_size, total and sample values.\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.poyo.ai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-5.2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a structured output assistant. Reply with JSON only.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Generate a paginated list response example with fields items, page, page_size, total and sample values.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"id": "chatcmpl-9876543210",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-5.2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The history of artificial intelligence (AI) dates back to the 1950s..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 320,
"total_tokens": 348
}
}
}General Chat API
Unified chat API interface supporting all text generation models
curl --request POST \
--url https://api.poyo.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-5.2",
"messages": [
{
"role": "system",
"content": "You are a structured output assistant. Reply with JSON only."
},
{
"role": "user",
"content": "Generate a paginated list response example with fields items, page, page_size, total and sample values."
}
]
}
'import requests
url = "https://api.poyo.ai/v1/chat/completions"
payload = {
"model": "gpt-5.2",
"messages": [
{
"role": "system",
"content": "You are a structured output assistant. Reply with JSON only."
},
{
"role": "user",
"content": "Generate a paginated list response example with fields items, page, page_size, total and sample values."
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-5.2',
messages: [
{
role: 'system',
content: 'You are a structured output assistant. Reply with JSON only.'
},
{
role: 'user',
content: 'Generate a paginated list response example with fields items, page, page_size, total and sample values.'
}
]
})
};
fetch('https://api.poyo.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.poyo.ai/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-5.2',
'messages' => [
[
'role' => 'system',
'content' => 'You are a structured output assistant. Reply with JSON only.'
],
[
'role' => 'user',
'content' => 'Generate a paginated list response example with fields items, page, page_size, total and sample values.'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.poyo.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"gpt-5.2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a structured output assistant. Reply with JSON only.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Generate a paginated list response example with fields items, page, page_size, total and sample values.\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.poyo.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-5.2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a structured output assistant. Reply with JSON only.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Generate a paginated list response example with fields items, page, page_size, total and sample values.\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.poyo.ai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-5.2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a structured output assistant. Reply with JSON only.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Generate a paginated list response example with fields items, page, page_size, total and sample values.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"id": "chatcmpl-9876543210",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-5.2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The history of artificial intelligence (AI) dates back to the 1950s..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 320,
"total_tokens": 348
}
}
}- Unified chat API interface supporting all text generation models
- Select different AI models via the model parameter
- Compatible with OpenAI Chat Completions API format
Usage Examples
Basic Conversation
{
"model": "gpt-5.2",
"messages": [
{"role": "user", "content": "Explain vector databases in one sentence."}
]
}
System Prompt
{
"model": "claude-sonnet-4-5-20250929",
"messages": [
{"role": "system", "content": "You are a technical editor. Improve clarity of product copy."},
{"role": "user", "content": "Rewrite the button text 'Submission failed' to be friendly and actionable."}
]
}
Multi-turn Conversation
{
"model": "gemini-3-flash-preview",
"messages": [
{"role": "user", "content": "Give me 3 customer support bot names."},
{"role": "assistant", "content": "1) HelpWave 2) CarePilot 3) SwiftSupport"},
{"role": "user", "content": "Add one style tag for each name."}
]
}
Streaming Output
{
"model": "gpt-5.2",
"messages": [
{"role": "user", "content": "Generate 5 short titles (max 6 words) about AI video generation."}
],
"stream": true
}
Notes
- Use
stream: truefor 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.
Authorizations
All API endpoints require Bearer Token authentication.
Get your API Key:
Visit the API Key Management Page to get your API Key
Add it to the request header:
Authorization: Bearer YOUR_API_KEY
Body
Model name. Example: gpt-5.2, claude-sonnet-4-5-20250929, gemini-3-flash-preview.
"gpt-5.2"
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."}].
Show child attributes
Show child attributes
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.
0 <= x <= 21
Maximum number of tokens to generate. Different models have different maximum limits.
x >= 1256
Whether to use streaming output. true returns a streaming response in SSE format. false returns the complete response at once. Default: false.
false
Nucleus sampling parameter, range 0-1. Controls diversity of generated text. We recommend using either top_p or temperature, not both. Default: 1.0.
0 <= x <= 11
Frequency penalty, range -2.0 to 2.0. Positive values reduce the likelihood of repeating the same words. Default: 0.
-2 <= x <= 20
Presence penalty, range -2.0 to 2.0. Positive values increase the likelihood of talking about new topics. Default: 0.
-2 <= x <= 20
Stop sequences. Up to 4 sequences where generation will stop when encountered.
"\n\nHuman:"
Number of completions to generate. Default: 1. Must be a plain number such as 1; do not use quotes.
x >= 11
