Stream Chat Completion
curl --request POST \
--url https://gateway.widebot.net/api/v1/AQL/stream/chat/completions \
--header 'Content-Type: application/json' \
--header 'x-bot: <api-key>' \
--header 'x-user-auth: <api-key>' \
--data '
{
"Message": "اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم",
"Config": {
"Temperature": 0.8,
"MaxTokens": 2048
},
"PromptStyle": 5
}
'import requests
url = "https://gateway.widebot.net/api/v1/AQL/stream/chat/completions"
payload = {
"Message": "اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم",
"Config": {
"Temperature": 0.8,
"MaxTokens": 2048
},
"PromptStyle": 5
}
headers = {
"x-user-auth": "<api-key>",
"x-bot": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-user-auth': '<api-key>',
'x-bot': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
Message: 'اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم',
Config: {Temperature: 0.8, MaxTokens: 2048},
PromptStyle: 5
})
};
fetch('https://gateway.widebot.net/api/v1/AQL/stream/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://gateway.widebot.net/api/v1/AQL/stream/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([
'Message' => 'اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم',
'Config' => [
'Temperature' => 0.8,
'MaxTokens' => 2048
],
'PromptStyle' => 5
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-bot: <api-key>",
"x-user-auth: <api-key>"
],
]);
$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://gateway.widebot.net/api/v1/AQL/stream/chat/completions"
payload := strings.NewReader("{\n \"Message\": \"اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم\",\n \"Config\": {\n \"Temperature\": 0.8,\n \"MaxTokens\": 2048\n },\n \"PromptStyle\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-user-auth", "<api-key>")
req.Header.Add("x-bot", "<api-key>")
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://gateway.widebot.net/api/v1/AQL/stream/chat/completions")
.header("x-user-auth", "<api-key>")
.header("x-bot", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Message\": \"اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم\",\n \"Config\": {\n \"Temperature\": 0.8,\n \"MaxTokens\": 2048\n },\n \"PromptStyle\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.widebot.net/api/v1/AQL/stream/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-user-auth"] = '<api-key>'
request["x-bot"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Message\": \"اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم\",\n \"Config\": {\n \"Temperature\": 0.8,\n \"MaxTokens\": 2048\n },\n \"PromptStyle\": 5\n}"
response = http.request(request)
puts response.read_body"data: {\"chunk\": \"# أهمية الذكاء الاصطناعي في التعليم\\n\\n\"}\n\ndata: {\"chunk\": \"يشهد قطاع التعليم تطوراً\"}\n\ndata: {\"chunk\": \" مذهلاً بفضل تقنيات الذكاء الاصطناعي\"}\n\ndata: {\"final\": true, \"metadata\": {\"total_tokens\": 456}, \"consumption\": \"456/10000000\"}\n"Streaming chat completion API that provides real-time response generation via server-sent events.
Key Features:
- Real-time response streaming
- Server-sent events
- Lower latency for long responses
- Progressive content delivery
Note: Example requests/responses shown here are illustrative. When using the live “Try it” tool, you may see two responses: an HTTP status preview from the client and the API’s JSON body (streamed chunks).
POST
/
api
/
v1
/
AQL
/
stream
/
chat
/
completions
Stream Chat Completion
curl --request POST \
--url https://gateway.widebot.net/api/v1/AQL/stream/chat/completions \
--header 'Content-Type: application/json' \
--header 'x-bot: <api-key>' \
--header 'x-user-auth: <api-key>' \
--data '
{
"Message": "اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم",
"Config": {
"Temperature": 0.8,
"MaxTokens": 2048
},
"PromptStyle": 5
}
'import requests
url = "https://gateway.widebot.net/api/v1/AQL/stream/chat/completions"
payload = {
"Message": "اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم",
"Config": {
"Temperature": 0.8,
"MaxTokens": 2048
},
"PromptStyle": 5
}
headers = {
"x-user-auth": "<api-key>",
"x-bot": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-user-auth': '<api-key>',
'x-bot': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
Message: 'اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم',
Config: {Temperature: 0.8, MaxTokens: 2048},
PromptStyle: 5
})
};
fetch('https://gateway.widebot.net/api/v1/AQL/stream/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://gateway.widebot.net/api/v1/AQL/stream/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([
'Message' => 'اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم',
'Config' => [
'Temperature' => 0.8,
'MaxTokens' => 2048
],
'PromptStyle' => 5
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-bot: <api-key>",
"x-user-auth: <api-key>"
],
]);
$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://gateway.widebot.net/api/v1/AQL/stream/chat/completions"
payload := strings.NewReader("{\n \"Message\": \"اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم\",\n \"Config\": {\n \"Temperature\": 0.8,\n \"MaxTokens\": 2048\n },\n \"PromptStyle\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-user-auth", "<api-key>")
req.Header.Add("x-bot", "<api-key>")
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://gateway.widebot.net/api/v1/AQL/stream/chat/completions")
.header("x-user-auth", "<api-key>")
.header("x-bot", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Message\": \"اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم\",\n \"Config\": {\n \"Temperature\": 0.8,\n \"MaxTokens\": 2048\n },\n \"PromptStyle\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.widebot.net/api/v1/AQL/stream/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-user-auth"] = '<api-key>'
request["x-bot"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Message\": \"اكتب لي مقالاً قصيراً عن أهمية الذكاء الاصطناعي في التعليم\",\n \"Config\": {\n \"Temperature\": 0.8,\n \"MaxTokens\": 2048\n },\n \"PromptStyle\": 5\n}"
response = http.request(request)
puts response.read_body"data: {\"chunk\": \"# أهمية الذكاء الاصطناعي في التعليم\\n\\n\"}\n\ndata: {\"chunk\": \"يشهد قطاع التعليم تطوراً\"}\n\ndata: {\"chunk\": \" مذهلاً بفضل تقنيات الذكاء الاصطناعي\"}\n\ndata: {\"final\": true, \"metadata\": {\"total_tokens\": 456}, \"consumption\": \"456/10000000\"}\n"Authorizations
Your API key from account settings
Your bot ID from account settings
Body
application/json
The message to send to the AQL model
Example:
"ما هي عاصمة مصر وما أهم معالمها السياحية؟"
Optional previous messages for context-aware conversations
Show child attributes
Show child attributes
Configuration parameters for text generation
Show child attributes
Show child attributes
Style of response generation:
- 0: Base (standard responses)
- 1: Expert (technical/formal)
- 2: Conversational (casual, dialogic)
- 3: Structured (organized with sections)
- 4: Concise (brief, to-the-point)
- 5: Detailed (comprehensive explanations)
Required range:
0 <= x <= 5Example:
3
Response
200 - text/event-stream
Streaming response via server-sent events
Server-sent events stream
Was this page helpful?
⌘I

