Beta mode — 1AI is currently in beta

Developer documentation

1AI API

Everything you need to call 1AI agents from your own code. The API is in beta — endpoints and responses may change.

Base URL

https://1ai-gateway.sojibahmmed.workers.dev

All endpoints below are relative to this URL.

Authentication

Send your key in the X-API-Key header on every request. API keys are issued per user — keep yours secret and never put it in browser code. The API is currently in beta.

X-API-Key: $ONEAI_API_KEY

Quick start

cURL

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/ai/chat" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"আমাকে একটি স্বাগত বার্তা লিখে দিন"}'

JavaScript (fetch)

const res = await fetch("https://1ai-gateway.sojibahmmed.workers.dev/v1/ai/chat", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.ONEAI_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ message: "Hello from Bangladesh" }),
});
const data = await res.json();
console.log(data);

Endpoints

GET/v1/health

Check that the gateway is up.

curl "https://1ai-gateway.sojibahmmed.workers.dev/v1/health" \
  -H "X-API-Key: $ONEAI_API_KEY"
GET/v1/agents

List the agents available to your key.

curl "https://1ai-gateway.sojibahmmed.workers.dev/v1/agents" \
  -H "X-API-Key: $ONEAI_API_KEY"
POST/v1/ai/chat

Send a chat message to an AI model.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/ai/chat" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"আমাকে একটি স্বাগত বার্তা লিখে দিন"}'
POST/v1/notify/send

Send an SMS or email notification.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/notify/send" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"channel":"sms","to":"+8801XXXXXXXXX","message":"Your order has shipped"}'
POST/v1/events/publish

Publish an event for workflows to react to.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/events/publish" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"order.created","data":{"order_id":"1001"}}'
POST/v1/memory/write

Store a memory item for an agent.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/memory/write" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"key":"customer:42","value":"Prefers Bangla"}'
POST/v1/payments/bkash/create

Create a bKash payment request.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/payments/bkash/create" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":499,"currency":"BDT","reference":"INV-1001"}'
POST/v1/courier/steadfast/create

Book a Steadfast courier delivery.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/courier/steadfast/create" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recipient_name":"Rahim","recipient_phone":"01XXXXXXXXX","address":"Dhaka","cod_amount":1200}'
POST/v1/courier/pathao/create

Book a Pathao courier delivery.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/courier/pathao/create" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recipient_name":"Karim","recipient_phone":"01XXXXXXXXX","address":"Chattogram","cod_amount":850}'
POST/v1/mcp/connect

Connect an MCP server to your account.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/mcp/connect" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/mcp"}'
POST/v1/mcp/call

Call a tool on a connected MCP server.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/mcp/call" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tool":"search","arguments":{"q":"hello"}}'
POST/v1/automation/build

Build a workflow from a plain-language description.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/automation/build" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"When an order is paid, book a courier and SMS the customer"}'
POST/v1/support/chat

Ask the website FAQ / support agent a question.

curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/support/chat" \
  -H "X-API-Key: $ONEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"What are your delivery charges?"}'
GET/v1/workflows/runs

List recent workflow runs.

curl "https://1ai-gateway.sojibahmmed.workers.dev/v1/workflows/runs" \
  -H "X-API-Key: $ONEAI_API_KEY"

Plans & quotas

PlanRequests / month
Free100
Pro10,000
Team100,000
Enterprise1,000,000