Authentication
Authenticate your client applications by including your generated Developer API Key as a Bearer token in the Authorization header of each HTTP request.
Header Syntax: Authorization: Bearer <YOUR_API_KEY>
Chat completions Gateway
Trigger agent reasonings, execution loops, memory recalls, and tool triggers sequentially via our centralized gateway endpoint.
POST
/v1/chat
Request Payload Parameters
| Parameter |
Type |
Required |
Description |
agent_id |
String (UUID) |
Yes |
The target ID of your configured agent. |
message |
String |
Yes |
The text instruction query to send to the agent reasoning engine. |
session_id |
String |
No |
An optional context session tracking key for retrieving conversation memory histories. |
stream |
Boolean |
No |
Set to true to stream response tokens dynamically using Server-Sent Events (SSE). Default is false. |
reasoning_enabled |
Boolean |
No |
Override the agent's thinking setting for this request. Set to true to enable chain-of-thought reasoning (shows a 💭 Thinking Process block in the response), or false to disable it. If omitted, the agent's configured default is used. |
images |
Array of Strings |
No |
An optional list of base64-encoded image data URLs (e.g. data:image/jpeg;base64,...) for multimodal/vision inputs. |
Sample Python Request
import json
import urllib.request
API_URL = "http://127.0.0.1:8000/v1/chat"
API_KEY = "your_developer_key_here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
payload = {
"agent_id": "your-agent-uuid-here",
"message": "Compute the square root of 144 plus 56",
"stream": False,
"reasoning_enabled": True, # optional — overrides agent default
"images": ["data:image/jpeg;base64,..."]
}
req = urllib.request.Request(API_URL, data=json.dumps(payload).encode('utf-8'), headers=headers, method="POST")
with urllib.request.urlopen(req) as res:
response_data = json.loads(res.read().decode('utf-8'))
print("Agent Response:", response_data["response"])
Sample Python SSE Stream Call
import urllib.request
import json
API_URL = "http://127.0.0.1:8000/v1/chat"
API_KEY = "your_developer_key_here"
payload = {
"agent_id": "your-agent-uuid-here",
"message": "What are my external mysql metrics?",
"stream": True,
"reasoning_enabled": False # optional — disable thinking for this call
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
req = urllib.request.Request(API_URL, data=json.dumps(payload).encode('utf-8'), headers=headers, method="POST")
with urllib.request.urlopen(req) as response:
for line in response:
decoded_line = line.decode('utf-8').strip()
if decoded_line.startswith("data: "):
data = json.loads(decoded_line[6:])
if "chunk" in data:
print(data["chunk"], end="", flush=True)
Retrieve Configured Agents
Fetch the list of your configured AI agents, including their IDs, custom system prompt layouts, attached tools, and active LLM models using your developer API Key.
GET
/v1/agents
Sample Python Request
import json
import urllib.request
API_URL = "http://127.0.0.1:8000/v1/agents"
API_KEY = "your_developer_key_here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
req = urllib.request.Request(API_URL, headers=headers, method="GET")
with urllib.request.urlopen(req) as res:
agents = json.loads(res.read().decode('utf-8'))
for agent in agents:
print(f"Agent Name: {agent['name']} | ID: {agent['id']}")
User Profile & Token Balance
Fetch account metadata, subscription tier levels, and monthly token quota metrics including total, used, and remaining balances.
GET
/v1/auth/profile
Sample Python Request
import json
import urllib.request
API_URL = "http://127.0.0.1:8000/v1/auth/profile"
API_KEY = "your_developer_key_here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
req = urllib.request.Request(API_URL, headers=headers, method="GET")
with urllib.request.urlopen(req) as res:
profile = json.loads(res.read().decode('utf-8'))
print("Email:", profile["email"])
print("Subscription Tier:", profile["subscription_tier"])
print("Remaining Tokens:", profile["remaining_monthly_tokens"])
Retrieve Usage Logs
Get historical usage metrics, tokens spent, execution latencies, and agent routing records with optional custom query limits.
GET
/v1/logs?limit=100
Sample Python Request
import json
import urllib.request
API_URL = "http://127.0.0.1:8000/v1/logs?limit=10"
API_KEY = "your_developer_key_here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
req = urllib.request.Request(API_URL, headers=headers, method="GET")
with urllib.request.urlopen(req) as res:
logs = json.loads(res.read().decode('utf-8'))
for log in logs:
print(f"Time: {log['created_at']} | Model: {log['model_id']} | Tokens: {log['input_tokens'] + log['output_tokens']}")
OpenAI-Compatible API NEW
Use the openai Python library as a drop-in replacement. Point it to your Egzora server and use your Agent ID or Agent Name as the model parameter.
POST
/v1/chat/completions
Setup (pip install)
pip install openai
Non-Streaming Example
from openai import OpenAI
client = OpenAI(
api_key="your_developer_key_here", # Your Egzora API key
base_url="http://127.0.0.1:8000/v1" # Your server URL
)
response = client.chat.completions.create(
model="your-agent-id-or-name", # Agent ID or Agent Name
messages=[
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Explain quantum computing in 3 sentences."}
],
temperature=0.7
)
print(response.choices[0].message.content)
Streaming Example
from openai import OpenAI
client = OpenAI(
api_key="your_developer_key_here",
base_url="http://127.0.0.1:8000/v1"
)
stream = client.chat.completions.create(
model="your-agent-id-or-name",
messages=[
{"role": "user", "content": "Write a short poem about AI."}
],
stream=True
)
for chunk in stream:
content = chunk.choices[0].delta.content or ""
print(content, end="", flush=True)
List Available Agents (Models)
GET
/v1/models
models = client.models.list()
for m in models.data:
print(f"Agent: {m.id} — {m.name}")