Create chat
curl --request POST \
--url https://macaly.com/api/chat \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat', 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://macaly.com/api/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://macaly.com/api/chat")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyVégpontok
Create chat
Új beszélgetés létrehozása és építés indítása AI-val
POST
/
api
/
chat
Create chat
curl --request POST \
--url https://macaly.com/api/chat \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat', 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://macaly.com/api/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://macaly.com/api/chat")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyÚj beszélgetést hoz létre, és elindítja az AI munkafolyamatot.
JSON-válasz (ha
Adatfolyam-válasz (ha
Ha az adatfolyam be van kapcsolva, a válasz egy szöveges adatfolyam:
Az első sor a beszélgetés azonosítóját tartalmazza
Kérés
POST /api/chat
Fejlécek
| Fejléc | Kötelező | Leírás |
|---|---|---|
Authorization | Igen | Bearer macaly_... |
Content-Type | Igen | application/json |
Törzsparaméterek
| Mező | Típus | Kötelező | Alapérték | Leírás |
|---|---|---|---|---|
content | string | Igen | - | A felhasználó üzenete / promptja |
stream | boolean | Nem | true | Ha false, adatfolyam helyett JSON-t ad vissza |
backend | string | Nem | "DEFAULT" | A használt háttérrendszer |
executionMode | "auto" | "planning" | "build" | Nem | - | Azt szabályozza, hogyan közelíti meg az AI a feladatot |
model | "gpt-5.6-terra" | "gpt-6.1-sol" | "gpt-6-luna" | "grok-4-6" | "kimi-k3" | "sonnet-5-5" | "opus-5-5" | "blueai-glm-5-3" | "blueai-glm-5-3-flash" | Nem | - | A használt AI-modell. Alapértelmezés szerint a munkaterületen beállított modell |
reasoningEffort | "medium" | "high" | Nem | - | Azt szabályozza, mennyire mélyen gondolkodik az AI a feladaton |
experimental_attachments | array | Nem | [] | Fájlmellékletek (a formátumot lásd lent) |
Mellékletek formátuma
Azexperimental_attachments tömb minden eleme a következő szerkezetű:
| Mező | Típus | Kötelező | Leírás |
|---|---|---|---|
url | string | Igen | A csatolandó fájl URL-je |
name | string | Nem | A melléklet megjelenített neve |
contentType | string | Nem | A fájl MIME-típusa |
Példa kérés
curl -X POST https://www.macaly.com/api/chat \
-H "Authorization: Bearer macaly_abc123..." \
-H "Content-Type: application/json" \
-d '{
"content": "Create a landing page for a coffee shop",
"stream": false
}'
const response = await fetch('https://www.macaly.com/api/chat', {
method: 'POST',
headers: {
'Authorization': 'Bearer macaly_abc123...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
content: 'Create a landing page for a coffee shop',
stream: false,
}),
});
const data = await response.json();
console.log(data.chatId);
import requests
response = requests.post(
'https://www.macaly.com/api/chat',
headers={
'Authorization': 'Bearer macaly_abc123...',
'Content-Type': 'application/json',
},
json={
'content': 'Create a landing page for a coffee shop',
'stream': False,
},
)
data = response.json()
print(data['chatId'])
Válasz
JSON-válasz (ha stream: false)
{
"chatId": "abc123def456",
"url": "https://www.macaly.com/chat/abc123def456",
"streamId": "stream_xyz789",
"assistantMessageId": "msg_123"
}
| Mező | Típus | Leírás |
|---|---|---|
chatId | string | A beszélgetés egyedi azonosítója |
url | string | A beszélgetés megtekintésére szolgáló közvetlen URL |
streamId | string | undefined | A feliratkozáshoz használt adatfolyam-azonosító. Csak munkafolyamat-alapú háttérrendszereknél szerepel |
assistantMessageId | string | undefined | A most generált asszisztensüzenet azonosítója. Csak munkafolyamat-alapú háttérrendszereknél szerepel |
Adatfolyam-válasz (ha stream: true, ez az alapérték)
Ha az adatfolyam be van kapcsolva, a válasz egy szöveges adatfolyam:
2:[{"chatId":"abc123def456"}]
0:"Starting to build..."
...
2:[{"chatId":"..."}] formában.
A beszélgetés azonosítójának kinyerése az adatfolyamból
const text = await response.text();
const match = text.match(/2:\[{"chatId":"([^"]+)"/);
const chatId = match?.[1];
Állapotkódok
| Állapot | Leírás |
|---|---|
| 200 | Sikeres - a beszélgetés létrejött |
| 400 | Érvénytelen kéréstörzs |
| 401 | Érvénytelen vagy hiányzó API-kulcs |
| 402 | Nincs elég kredit |
| 403 | Tiltott - Nincs jogosultság a megadott munkaterülethez |
| 422 | Érvényesítési hiba |
| 429 | Túllépted a kérési korlátot |
| 500 | Szerverhiba |
Következő lépések
A beszélgetés létrehozása után:- Kérdezd le az állapotot a befejezésig a
GET /api/chat/{chatId}/statusvégponttal - Iratkozz fel az adatfolyamra a
GET /api/chat/{chatId}/subscribevégponttal a valós idejű frissítésekhez - Küldj további üzeneteket a
POST /api/chat/{chatId}/publishvégponttal
Hasznos volt ez az oldal?