API Reference
Chat Completion
API endpoint for conversational website planning and design
POST
/
codenull
/
ai
/
api
/
v1
/
chat-completion
Process Chat Completion
curl --request POST \
--url https://api.example.com/codenull/ai/api/v1/chat-completion \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"user_prompt": {
"content": "<string>",
"role": "user"
}
}
'import requests
url = "https://api.example.com/codenull/ai/api/v1/chat-completion"
payload = {
"project_id": "<string>",
"user_prompt": {
"content": "<string>",
"role": "user"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({project_id: '<string>', user_prompt: {content: '<string>', role: 'user'}})
};
fetch('https://api.example.com/codenull/ai/api/v1/chat-completion', 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.example.com/codenull/ai/api/v1/chat-completion",
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([
'project_id' => '<string>',
'user_prompt' => [
'content' => '<string>',
'role' => 'user'
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/codenull/ai/api/v1/chat-completion"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"user_prompt\": {\n \"content\": \"<string>\",\n \"role\": \"user\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/codenull/ai/api/v1/chat-completion")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"user_prompt\": {\n \"content\": \"<string>\",\n \"role\": \"user\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/codenull/ai/api/v1/chat-completion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"user_prompt\": {\n \"content\": \"<string>\",\n \"role\": \"user\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": "<string>",
"messages": [
{}
],
"created_at": "<string>",
"updated_at": "<string>",
"ready_for_generation": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Example Usage
For complete API documentation and examples, please refer to your Swagger UI.curl -X 'POST' \
'https://localhost:8080/codenull/ai/api/v1/chat-completion' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"user_prompt": {
"role": "user",
"content": "I need a portfolio website for a photographer"
}
}'
Body
application/json
Response
Successful Response
UUID of the conversation document
Project ID as UUID
Array of messages in the conversation
Show child attributes
Show child attributes
Timestamp when the conversation was created
Timestamp when the conversation was last updated
Flag indicating if website requirements are confirmed and ready for generation
Previous
Generate WebsiteAPI endpoint to generate a complete website based on conversation history
Next
⌘I
Process Chat Completion
curl --request POST \
--url https://api.example.com/codenull/ai/api/v1/chat-completion \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"user_prompt": {
"content": "<string>",
"role": "user"
}
}
'import requests
url = "https://api.example.com/codenull/ai/api/v1/chat-completion"
payload = {
"project_id": "<string>",
"user_prompt": {
"content": "<string>",
"role": "user"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({project_id: '<string>', user_prompt: {content: '<string>', role: 'user'}})
};
fetch('https://api.example.com/codenull/ai/api/v1/chat-completion', 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.example.com/codenull/ai/api/v1/chat-completion",
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([
'project_id' => '<string>',
'user_prompt' => [
'content' => '<string>',
'role' => 'user'
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/codenull/ai/api/v1/chat-completion"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"user_prompt\": {\n \"content\": \"<string>\",\n \"role\": \"user\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/codenull/ai/api/v1/chat-completion")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"user_prompt\": {\n \"content\": \"<string>\",\n \"role\": \"user\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/codenull/ai/api/v1/chat-completion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"user_prompt\": {\n \"content\": \"<string>\",\n \"role\": \"user\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": "<string>",
"messages": [
{}
],
"created_at": "<string>",
"updated_at": "<string>",
"ready_for_generation": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}