How It Works

This page walks through the full lifecycle of an Aomi-powered assistant -- from your existing APIs to a deployed product your users can talk to. We use MyCoinDex, a fictional crypto exchange, as the running example.

The Pipeline

1. Your APIs

MyCoinDex exposes standard HTTP endpoints. Aomi does not modify them.

EndpointMethodDescription
/prices/{symbol}GETCurrent token price
/tradesPOSTExecute a trade
/portfolio/{userId}GETUser portfolio and P&L
/marketsGETAvailable trading pairs
/orderbook/{pair}GETOrder book depth

2. APIs Become AI Tools

Aomi wraps each endpoint as a tool -- a typed function the LLM can invoke during a conversation. Each tool has a name, a description (so the model knows when to use it), and typed parameters.

When a user asks "What's ETH trading at?", the model calls GetTokenPrice with { symbol: "ETH" }. The tool hits MyCoinDex's /prices/eth, returns the result, and the model composes a natural-language response.

Tools can execute concurrently. If the model needs both a price and a portfolio balance, it calls both tools in parallel.

3. Configuring the Assistant

Three settings define the assistant's behavior:

Preamble

The system prompt that shapes personality and rules:

You are the MyCoinDex trading assistant. You help users check
prices, manage portfolios, and execute trades.

Always confirm with the user before executing a trade.
Show prices in USD unless the user requests otherwise.

Model Selection

The LLM that powers the assistant. Supported providers:

ProviderModels
AnthropicClaude Sonnet, Claude Haiku
OpenAIGPT-4o, GPT-4o Mini
OpenRouterAccess to 100+ models

Models can be changed at runtime via the control API -- no redeployment needed.

RAG Document Store (Optional)

If MyCoinDex has documentation, FAQs, or knowledge base articles, Aomi ingests them into a vector store. The assistant searches these documents when answering questions beyond tool capabilities.

4. Deployed as an App

The configured app becomes an app -- a self-contained assistant environment on Aomi's hosted backend.

App:        "mycoindex"
Endpoint:   POST /api/chat?app=mycoindex
Tools:      GetTokenPrice, ExecuteTrade, GetPortfolio, ListMarkets
Preamble:   MyCoinDex trading assistant
Model:      Claude Sonnet (default, switchable)

Each app is isolated. MyCoinDex's tools, preamble, and configuration do not affect other apps on the platform.

5. API Key and Authentication

MyCoinDex receives an API key scoped to their app. Every request includes:

X-API-Key: sk-mcd-a1b2c3d4e5f6
X-Session-Id: 550e8400-e29b-41d4-a716-446655440000

The backend validates the key, confirms it authorizes access to the mycoindex app, and proceeds.

6. The Request Flow

Here is what happens when a user sends a message:

Step by Step

  1. User sends a message via the widget or headless integration.
  2. Frontend sends HTTP POST to /api/chat?app=mycoindex with the API key and session ID.
  3. Backend validates the API key and loads the session.
  4. Backend sends message + history + tools to the selected LLM.
  5. LLM decides to call tools -- requests GetPortfolio and GetTokenPrice.
  6. Backend executes tool calls against MyCoinDex's APIs.
  7. Tool results go back to the LLM for interpretation.
  8. LLM streams its response -- the backend forwards each text chunk as an SSE event.
  9. Frontend renders incrementally -- the user sees text appear in real-time.
  10. Complete event signals the response is finished.

SSE Stream Format

The response is a stream of Server-Sent Events:

data: {"type":"text","content":"Your ETH "}

data: {"type":"text","content":"position is worth "}

data: {"type":"text","content":"$8,750"}

data: {"type":"tool_call","name":"GetPortfolio","args":{"userId":"user123"}}

data: {"type":"tool_result","name":"GetPortfolio","result":{"eth":2.5,"value_usd":8750}}

data: {"type":"complete"}

Each event is a JSON object with a type field. The frontend processes these to render streaming text, tool call indicators, and completion state.

Event TypePurpose
textIncremental text chunk from the LLM
tool_callThe model is invoking a tool
tool_resultResult returned from a tool execution
completeResponse finished

What You Get

CapabilityDetailsManaged By
AI assistantUnderstands your product, calls your APIsAomi
Streaming chatReal-time responses via SSEAomi
Tool executionLLM calls your APIs as needed during conversationsAomi
Session managementPersistent threads, history, and stateAomi
Multi-model supportSwitch between Claude, GPT-4o, and others at runtimeAomi
Wallet integrationOptional Web3 wallet connect for on-chain actionsAomi
Scaling and availabilityHosted infrastructure, no GPUs or LLM keys to manageAomi
Your API endpointsStandard HTTP -- no modifications requiredYou
Frontend integrationWidget, headless, or TelegramYou
API key securityStore securely, never expose client-sideYou

Next Steps

On this page