Skip to main content

API Reference

Chat Completions

Endpoint: POST https://api.anotiai.com/v1/llm/chat/completions

Supported Models

  • openai:gpt-4o - OpenAI's most capable model
  • openai:gpt-4-turbo - Fast and intelligent
  • openai:gpt-3.5-turbo - Fast and affordable
  • anthropic:claude-3-opus - Most powerful Claude model
  • anthropic:claude-3-sonnet - Balanced performance and speed
  • anthropic:claude-3-haiku - Fastest Claude model
  • gemini:1.5-pro - Google's advanced model
  • gemini:1.5-flash - Fast and efficient
  • groq:llama-3.1-70b - Ultra-fast inference
  • deepseek:chat - DeepSeek's chat model

Request Body

{
"model_id": "string", // Required: Model identifier (e.g., "openai:gpt-4o")
"prompt": "string", // Required: The user's message
"stream": false // Optional: Enable streaming response
}

Response

{
"id": "string",
"choices": [
{
"message": {
"role": "assistant",
"content": "string"
}
}
],
"usage": {
"prompt_tokens": number,
"completion_tokens": number,
"total_tokens": number
}
}

Examples

JavaScript

const response = await fetch(
"https://api.anotiai.com/v1/llm/chat/completions",
{
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model_id: "openai:gpt-4o",
prompt: "Explain quantum computing",
stream: false,
}),
},
);

const data = await response.json();
console.log(data.choices[0].message.content);

Python

import requests

response = requests.post(
"https://api.anotiai.com/v1/llm/chat/completions",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"model_id": "openai:gpt-4o",
"prompt": "Explain quantum computing",
"stream": False
}
)

data = response.json()
print(data["choices"][0]["message"]["content"])

cURL

curl -X POST https://api.anotiai.com/v1/llm/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type": application/json" \
-d '{
"model_id": "openai:gpt-4o",
"prompt": "Explain quantum computing",
"stream": false
}'

Go

package main

import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)

func main() {
payload := map[string]interface{}{
"model_id": "openai:gpt-4o",
"prompt": "Explain quantum computing",
"stream": false,
}
body, _ := json.Marshal(payload)

req, _ := http.NewRequest("POST",
"https://api.anotiai.com/v1/llm/chat/completions",
bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")

client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}

Ruby

require 'net/http'
require 'json'

uri = URI("https://api.anotiai.com/v1/llm/chat/completions")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = {
model_id: "openai:gpt-4o",
prompt: "Explain quantum computing",
stream: false
}.to_json

response = http.request(request)
data = JSON.parse(response.body)
puts data["choices"][0]["message"]["content"]

PHP

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,
"https://api.anotiai.com/v1/llm/chat/completions");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"model_id" => "openai:gpt-4o",
"prompt" => "Explain quantum computing",
"stream" => false
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data["choices"][0]["message"]["content"];
curl_close($ch);
?>