Create a chat completion
curl --request POST \
--url https://api.ecopi.chat/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "internta-v02",
"messages": [
{
"content": "<string>"
}
]
}
'import requests
url = "https://api.ecopi.chat/v1/chat/completions"
payload = {
"model": "internta-v02",
"messages": [{ "content": "<string>" }]
}
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: 'internta-v02', messages: [{content: '<string>'}]})
};
fetch('https://api.ecopi.chat/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.ecopi.chat/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' => 'internta-v02',
'messages' => [
[
'content' => '<string>'
]
]
]),
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.ecopi.chat/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"internta-v02\",\n \"messages\": [\n {\n \"content\": \"<string>\"\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.ecopi.chat/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"internta-v02\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ecopi.chat/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\": \"internta-v02\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-1753709210352",
"object": "chat.completion",
"created": 1753709210,
"model": "internta-v02",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Sure! Synthetic biology is an interdisciplinary field..."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 100,
"completion_tokens": 10,
"total_tokens": 110
},
"system_fingerprint": "fp_2f57f81c11"
}API Reference
Create a chat completion
Creates a completion for the chat message
POST
/
chat
/
completions
Create a chat completion
curl --request POST \
--url https://api.ecopi.chat/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "internta-v02",
"messages": [
{
"content": "<string>"
}
]
}
'import requests
url = "https://api.ecopi.chat/v1/chat/completions"
payload = {
"model": "internta-v02",
"messages": [{ "content": "<string>" }]
}
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: 'internta-v02', messages: [{content: '<string>'}]})
};
fetch('https://api.ecopi.chat/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.ecopi.chat/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' => 'internta-v02',
'messages' => [
[
'content' => '<string>'
]
]
]),
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.ecopi.chat/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"internta-v02\",\n \"messages\": [\n {\n \"content\": \"<string>\"\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.ecopi.chat/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"internta-v02\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ecopi.chat/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\": \"internta-v02\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-1753709210352",
"object": "chat.completion",
"created": 1753709210,
"model": "internta-v02",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Sure! Synthetic biology is an interdisciplinary field..."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 100,
"completion_tokens": 10,
"total_tokens": 110
},
"system_fingerprint": "fp_2f57f81c11"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
200 - application/json
Successful response
A unique identifier for the completion
Example:
"chatcmpl-1753709210352"
The object type
Example:
"chat.completion"
The Unix timestamp (in seconds) of when the completion was created
Example:
1753709210
The model used for the completion
Example:
"internta-v02"
A list of completion choices
Show child attributes
Show child attributes
Usage statistics for the completion request
Show child attributes
Show child attributes
This fingerprint represents the backend configuration that the model runs with
Example:
"fp_2f57f81c11"
⌘I