ADITO-LLM
The ADITO-LLM API exposes the self-hosted model through an OpenAI-compatible interface. Use it to add chat completions, structured outputs, and function calling to your ADITO customizations and integrations.
The API uses the same request and response structure as the OpenAI API. You can use official OpenAI client libraries (such as openai for JavaScript/TypeScript) by changing only the base URL and API key.
Base URL and endpoints
| Endpoint | URL |
|---|---|
| Base URL | https://ai.adito.cloud |
| Chat completions | /chat/completions |
The underlying model is multimodal and can process both text and image inputs. For a full list of available endpoints and their parameters, refer to the OpenAI API reference.
Authentication
Every request requires an API key, passed as the apiKey parameter when initializing the client. Managed cloud systems receive a system API key automatically at startup. If you need a personal key, contact the AI team.
Keep your API key confidential. Do not expose it in client-side code or public repositories.
Request parameters
The API follows the OpenAI chat completions format. The table below lists the most commonly used parameters.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | String | Yes | Name of the model to use, e.g. adito-llm. |
messages | Array | Yes | Array of message objects, each with a role and content field. |
temperature | Number | No | Controls response creativity. Lower values produce more deterministic output. |
max_tokens | Number | No | Maximum number of tokens in the response. |
guided_json | Object | No | ADITO-specific. JSON schema that constrains the model output. See Guided JSON output. |
guided_json is not the same as the standard OpenAI response_format parameter. It is an ADITO-specific extension that enforces a JSON schema on the model output at the inference level. Do not use response_format — use guided_json instead.
For a full list of supported parameters, refer to the OpenAI API documentation.
Usage examples
The code examples on this page are not JDITO code. They illustrate general API usage and can be adapted to any language or HTTP client.
Basic chat completion
- curl
- JavaScript
curl https://ai.adito.cloud/chat/completions \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "adito-llm",
"messages": [
{ "role": "system", "content": "You are a CRM assistant. Summarize customer interactions in two sentences." },
{ "role": "user", "content": "Customer Acme Corp had 3 calls last week about delayed shipments, followed by a meeting where a 10% discount was offered." }
],
"temperature": 0.7
}'
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://ai.adito.cloud',
apiKey: 'your-api-key'
});
async function getCompletion() {
const response = await openai.chat.completions.create({
model: 'adito-llm',
messages: [
{ role: 'system', content: 'You are a CRM assistant. Summarize customer interactions in two sentences.' },
{ role: 'user', content: 'Customer Acme Corp had 3 calls last week about delayed shipments, followed by a meeting where a 10% discount was offered.' }
],
temperature: 0.7
});
console.log(response.choices[0].message.content);
}
getCompletion();
Guided JSON output
The API supports guided JSON output, which constrains the model response to match a defined JSON schema. This is useful when the result needs to be processed programmatically — for example, to create or update CRM records.
Click to expand guided JSON example
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://ai.adito.cloud',
apiKey: 'your-api-key'
});
async function classifyEmail() {
const response = await openai.chat.completions.create({
model: 'adito-llm',
messages: [
{
role: 'system',
content: 'You are a CRM email classifier. Analyze the email and return structured data.'
},
{
role: 'user',
content: `Classify this email:\n\nSubject: Urgent — production system down\nBody: Our main ERP integration has stopped syncing since this morning. We need immediate help. This is blocking 50+ users.`
}
],
temperature: 0.15,
// guided_json is ADITO-specific — do not use response_format
guided_json: {
type: 'object',
properties: {
subject_summary: { type: 'string' },
priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
category: { type: 'string', enum: ['bug', 'feature_request', 'support', 'billing', 'other'] },
suggested_team: { type: 'string' }
},
required: ['subject_summary', 'priority', 'category'],
additionalProperties: false
}
});
console.log(response.choices[0].message.content);
// → {"subject_summary":"ERP integration sync failure","priority":"critical","category":"bug","suggested_team":"Integrations"}
}
classifyEmail();
Function calling and tool use
The API supports OpenAI-style function calling. You define tools as part of the request, and the model decides when to invoke them based on the conversation context.
The example below shows a CRM scenario: the user asks about a contact's recent activity, and the model calls two tools — one to look up activities and another to create a follow-up task.
Click to expand function calling example
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://ai.adito.cloud',
apiKey: 'your-api-key'
});
async function handleContactQuery() {
const response = await openai.chat.completions.create({
model: 'adito-llm',
messages: [
{
role: 'system',
content: 'You are a CRM assistant. Use the available tools to look up data and create records.'
},
{
role: 'user',
content: 'Show me the last 5 activities for contact "Maria Hoffmann" and create a follow-up call for next Monday.'
}
],
tools: [
{
type: 'function',
function: {
name: 'get_contact_activities',
description: 'Retrieve recent activities for a CRM contact.',
parameters: {
type: 'object',
properties: {
contact_name: { type: 'string', description: 'Full name of the contact' },
limit: { type: 'number', description: 'Maximum number of activities to return' }
},
required: ['contact_name']
}
}
},
{
type: 'function',
function: {
name: 'create_activity',
description: 'Create a new activity (call, meeting, task) in the CRM.',
parameters: {
type: 'object',
properties: {
contact_name: { type: 'string', description: 'Full name of the contact' },
activity_type: { type: 'string', enum: ['call', 'meeting', 'task'], description: 'Type of activity' },
subject: { type: 'string', description: 'Subject line for the activity' },
due_date: { type: 'string', description: 'Due date in YYYY-MM-DD format' }
},
required: ['contact_name', 'activity_type', 'subject', 'due_date']
}
}
}
],
tool_choice: 'auto',
temperature: 0.15
});
// Process tool calls from the response
const toolCalls = response.choices[0].message.tool_calls;
if (toolCalls) {
toolCalls.forEach(call => {
console.log(`Tool: ${call.function.name}, Args: ${call.function.arguments}`);
});
}
}
handleContactQuery();
Error handling
API requests can fail due to authentication errors, rate limits, or invalid parameters. Wrap your calls in a try/catch block and inspect the error response.
async function safeChatCompletion() {
try {
const response = await openai.chat.completions.create({
model: 'adito-llm',
messages: [
{ role: 'user', content: 'Summarize this account.' }
]
});
return response.choices[0].message.content;
} catch (error) {
// The OpenAI client throws an error with status and message
console.error(`API error: ${error.status} — ${error.message}`);
// Common status codes:
// 401 — Invalid or missing API key
// 429 — Rate limit exceeded, retry after a delay
// 500 — Server error, retry or contact the AI team
}
}
Best practices
- Be specific in system prompts. Define the assistant's role, the expected output format, and any constraints. A system message like "You are a CRM assistant that responds only in JSON" produces more consistent results than a generic instruction.
- Use low temperature for structured tasks. Set
temperatureto0.1–0.2when the output must be deterministic (e.g., classification, data extraction). Use higher values (0.5–0.8) for creative tasks like drafting emails. - Constrain outputs with
guided_json. Whenever you need to process the response programmatically, define a schema. This prevents malformed output and removes the need for post-processing. - Keep prompts focused. One task per request produces better results than combining multiple tasks in a single prompt.
For more strategies on effective prompt engineering, refer to the Prompting Guide.
See also: Capabilities | Roadmap | AI Overview