Chat
Create response
JSON body with messages, a non-empty chat-style array, and optional model. The server builds the Responses input from stored history plus the last user turn, sets stream: true, and streams a compatible Responses request. Response is JSON or text/event-stream.
If the last user text is /new, same as completions: new session and minimal SSE without calling inference.
CORS: OPTIONS returns 204 with no body.
POST
https://ageneral.ai
/
v1
/
chat
/
responses
Create response
curl --request POST \
--url https://ageneral.ai/v1/chat/responses \
--header 'Ageneral-Project-Id: <ageneral-project-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{}
],
"model": "openai/gpt-4o-mini"
}
'import requests
url = "https://ageneral.ai/v1/chat/responses"
payload = {
"messages": [{}],
"model": "openai/gpt-4o-mini"
}
headers = {
"Ageneral-Project-Id": "<ageneral-project-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Ageneral-Project-Id': '<ageneral-project-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({messages: [{}], model: 'openai/gpt-4o-mini'})
};
fetch('https://ageneral.ai/v1/chat/responses', 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://ageneral.ai/v1/chat/responses",
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([
'messages' => [
[
]
],
'model' => 'openai/gpt-4o-mini'
]),
CURLOPT_HTTPHEADER => [
"Ageneral-Project-Id: <ageneral-project-id>",
"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://ageneral.ai/v1/chat/responses"
payload := strings.NewReader("{\n \"messages\": [\n {}\n ],\n \"model\": \"openai/gpt-4o-mini\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Ageneral-Project-Id", "<ageneral-project-id>")
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://ageneral.ai/v1/chat/responses")
.header("Ageneral-Project-Id", "<ageneral-project-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {}\n ],\n \"model\": \"openai/gpt-4o-mini\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ageneral.ai/v1/chat/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Ageneral-Project-Id"] = '<ageneral-project-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {}\n ],\n \"model\": \"openai/gpt-4o-mini\"\n}"
response = http.request(request)
puts response.read_body{}Authorizations
Headers
Body
application/json
Response
Success. JSON or SSE stream.
OpenAI-compatible Responses output when not streaming.
⌘I
Create response
curl --request POST \
--url https://ageneral.ai/v1/chat/responses \
--header 'Ageneral-Project-Id: <ageneral-project-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{}
],
"model": "openai/gpt-4o-mini"
}
'import requests
url = "https://ageneral.ai/v1/chat/responses"
payload = {
"messages": [{}],
"model": "openai/gpt-4o-mini"
}
headers = {
"Ageneral-Project-Id": "<ageneral-project-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Ageneral-Project-Id': '<ageneral-project-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({messages: [{}], model: 'openai/gpt-4o-mini'})
};
fetch('https://ageneral.ai/v1/chat/responses', 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://ageneral.ai/v1/chat/responses",
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([
'messages' => [
[
]
],
'model' => 'openai/gpt-4o-mini'
]),
CURLOPT_HTTPHEADER => [
"Ageneral-Project-Id: <ageneral-project-id>",
"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://ageneral.ai/v1/chat/responses"
payload := strings.NewReader("{\n \"messages\": [\n {}\n ],\n \"model\": \"openai/gpt-4o-mini\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Ageneral-Project-Id", "<ageneral-project-id>")
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://ageneral.ai/v1/chat/responses")
.header("Ageneral-Project-Id", "<ageneral-project-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {}\n ],\n \"model\": \"openai/gpt-4o-mini\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ageneral.ai/v1/chat/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Ageneral-Project-Id"] = '<ageneral-project-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {}\n ],\n \"model\": \"openai/gpt-4o-mini\"\n}"
response = http.request(request)
puts response.read_body{}