Complete reference for interacting directly with the APUS AI Router Process
@apus/ai
library. All interactions are standard AO messages.
$APUS
Environment: This operation is performed on the AO Legacy Network.
aos your_process
To purchase Credits, you perform a standard Transfer
to the $APUS
token process, with the Recipient
tag pointing to our Router Process.
mqBYxpDsolZmJyBdTK8TJp_ftOuIUXVYcSQ8MYZdJg0
(APUS Token Process ID)Transfer
Tag | Type | Required | Description |
---|---|---|---|
Action | string | Yes | Must be "Transfer" . |
Recipient | string | Yes | The AI-Infer Router Process ID : Bf6JJR2tl2Wr38O2-H6VctqtduxHgKF-NzRB9HhTRzo`. |
Quantity | string | Yes | The amount of $APUS tokens to transfer. The credits you receive will be based on the current exchange rate. |
X-Reason | string | Yes | Must be Buy-Credits to indicate the purpose of the transfer. |
Environment: This operation must be performed while connected to the APUS HyperBEAM Node.
*aos --mainnet http://72.46.85.207:8734*
To initiate an AI inference, send a message directly to our Router Process.
Infer
Tag | Type | Required | Description |
---|---|---|---|
Action | string | Yes | Must be "Infer" . |
X-Prompt | string | Yes | The text prompt to send to the AI model. |
X-Reference | string | No, but recommended! | A unique identifier for your request. If omitted, the message’s own ID will be used. It’s highly recommended for tracking responses. |
X-Session | string | No | An existing session ID to continue a conversation. If omitted, a new session is created. |
X-Options | json | No | A JSON string containing runtime parameters to customize the inference. See the table below for available options. |
X-Options
JSON Parameters:
These parameters allow you to control the behavior of the Gemma3-27B
model for each request.
Parameter | Type | Default | Range | Description |
---|---|---|---|---|
temperature | float | 0.7 | 0.0 - 2.0 | Controls randomness. Lower values are more deterministic, higher values are more creative. |
top_p | float | 0.9 | 0.0 - 1.0 | Nucleus sampling. The model considers only the tokens with the highest probability mass. |
max_tokens | integer | 2048 | 1 - 8192 | The maximum number of tokens to generate in the response. |
Environment: This operation must be performed while connected to the APUS HyperBEAM Node.
*aos --mainnet http://72.46.85.207:8734*
To get the response of your AI inference, handle message send by our Router Process.
Example Lua Handler:
Tag | Type | Description |
---|---|---|
Action | string | "Infer-Response" |
Data | json | Response of AI Inference in json format. |
Data.attestation | string | GPU attestation report. |
Data.result | string | AI Inference result. |
X-Session | string | The session id you passed in. |
X-Reference | string | The reference id you passed in, you not provided, generated automatically. |
Tag | Type | Description |
---|---|---|
Action | string | "Infer-Response" |
Code | string | Error code. |
X-Reference | string | Error message. |
patch@1.0
)Brief Intro: Patch API is introduced by HyperBEAM for improves performance for web frontends and data services by replacing the need forOur Router Process uses HyperBEAM’sdryrun
calls, which were a known bottleneck onlegacynet
. Prerequisites: Please read https://cookbook_ao.arweave.net/guides/migrating-to-hyperbeam/exposing-process-state.html to learn how to migrate to HyperBEAM.
patch@1.0
device to expose its internal state for efficient, read-only access over HTTP. This is the best way to monitor your tasks and credits without sending messages.
http://72.46.85.207:8734/{Router_Process_ID}~process@1.0/now/cache/
.../now/cache/credits/UIpgvCAjEajkAwH7qAAun0ybS3awepNO_kXa70cTZoU
task_reference
is {client_process_id}-{user_reference}
.
.../now/cache/tasks/UIpgvCAjEajkAwH7qAAun0ybS3awepNO_kXa70cTZoU-1721644800
task
object):
.../now/cache/taskStats
{ "total_tasks": 150, "pending": 10, "processing": 5, "successed": 130, "failed": 5 }