
Each agent has a Use through the API section, on the Agents tab of All in One AI. There you find the agent id, with a Copy button, and three ready-made examples: curl, Python and Node.js. The examples already include the API address and the name of the key variable: MOZOUT_API_KEY.
The three steps in the section
|
|
|
Keep the key in the variable
On Windows, open Command Prompt or PowerShell and type (with your key in quotes):
setx MOZOUT_API_KEY "prod_..."
setx saves the variable for the windows you open afterwards. Close the terminal and the tool, then open them again.
On Linux and macOS, type in the terminal:
export MOZOUT_API_KEY="prod_..."
To have the variable in every new terminal, add the same line at the end of ~/.bashrc or ~/.zshrc.
curl
In a Linux or macOS terminal:
curl "https://api.mozout.co.mz/v1/chat/completions" \
-H "Authorization: Bearer $MOZOUT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "agent/7c1e9a42-b35d8f06-a2c4e719-5d0b3f8e", "messages": [{"role": "user", "content": "Hi! What time do you open tomorrow?"}]}'
On Windows, use the Python or Node.js example, which work the same way on every system.
Python
Install the OpenAI SDK with pip install openai, save the code as agent.py and run python agent.py:
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.mozout.co.mz/v1", api_key=os.environ["MOZOUT_API_KEY"])
completion = client.chat.completions.create(
model="agent/7c1e9a42-b35d8f06-a2c4e719-5d0b3f8e",
messages=[{"role": "user", "content": "Hi! What time do you open tomorrow?"}],
)
print(completion.choices[0].message.content)
Node.js
Install the SDK with npm install openai, save the code as agent.mjs and run node agent.mjs. The .mjs ending is needed because the example uses import and await outside a function:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.mozout.co.mz/v1", apiKey: process.env.MOZOUT_API_KEY });
const completion = await client.chat.completions.create({
model: "agent/7c1e9a42-b35d8f06-a2c4e719-5d0b3f8e",
messages: [{ role: "user", content: "Hi! What time do you open tomorrow?" }],
});
console.log(completion.choices[0].message.content);
In all three, the answer is in choices[0].message.content and the token count in usage.
| The examples in the section do not include max_tokens. Add it if you want shorter answers than the agent's maximum: the request can lower that value, never raise it. To show the text as it is written, see an agent's answer with streaming. |
|
Want your agent answering inside your program? See All in One AI. See All in One AI |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from $6.60/mo (3-year plan, with coupon) See plans |











