Skip to content

Next Action API (POST /v1/act)

POSThttps://llm.manina.ai/v1/act

Predicts the next single-step UI operation for a task running on an iPhone or Android phone. Send the current screenshot, the plain-language goal, a numbered step plan, and optional recent action history; Manina-4B-Lite-1.0 returns the chosen operation (op), which plan step matches the current screen (step), and, when tapping or aiming a directional swipe, the target point and box in your original image pixels. Note that TYPE, KEY, and OPEN identify when and where to type, press a key, or launch an app, while your caller or planner supplies the literal text or app name. Every HTTP 200 answer is billed at $0.0003 per call ($0.30 per 1,000 calls), and errors are never billed.

AI Agent & CLI shortcut: Feed manina.ai/llms-full.txt to your AI coding agent to build a complete execution loop, or run manina run “Open Settings and go to Wi-Fi” directly with npm i -g manina.

act.py
import base64
import json
import os
import urllib.request
with open("screenshot.png", "rb") as f:
image_b64 = base64.b64encode(f.read()).decode("ascii")
payload = {
"image": image_b64,
"goal": "Open Wi-Fi settings",
"plan": "1. Open Settings\n2. Tap Wi-Fi",
"history": '{"action": "open", "app": "Settings"} -> screen changed',
}
req = urllib.request.Request(
"https://llm.manina.ai/v1/act",
data=json.dumps(payload).encode("utf-8"),
headers={
"Authorization": f"Bearer {os.environ['MANINA_API_KEY']}",
"Content-Type": "application/json",
},
method="POST",
)
with urllib.request.urlopen(req) as resp:
step = json.loads(resp.read().decode("utf-8"))
print(step["op"], step["step"], step.get("point"))
Name Type Required Description
Authorization string yes Bearer hsk_live_… in production, or Bearer hsk_test_… in Sandbox. Create keys in your account (API keys →).
Content-Type string yes Must be application/json. Maximum request body size is 12 MB.

Unknown JSON fields are rejected with 400 invalid_request.

Name Type Required Description
image string yes Base64-encoded PNG, JPEG, or WebP screenshot (data:image/…;base64, prefix and newlines accepted). Resized server-side to 540 px wide JPEG.
goal string yes Plain-language task goal, 1 to 1,000 characters after trimming whitespace.
plan string | null no Numbered step list (1. …, 2) …, or 3、…), one action per line, up to 4,000 characters. If omitted or null, defaults to 1. <goal> (supplying explicit numbered steps improves step tracking).
history string | null no Up to the last ~5 executed actions, oldest first, one per line, up to 8,000 characters (format below). Omit or pass null before the first step.

Each line records the executed JSON action (with tap coordinates normalized to 0 to 1000 of image width/height) and whether the screen changed afterward:

history
{"action": "open", "app": "Settings"} -> screen changed
{"action": "tap", "x": 478, "y": 250} -> screen did NOT change

Supported action shapes in history:

  • {"action": "tap", "x": 0..1000, "y": 0..1000}
  • {"action": "swipe", "direction": "up" | "down" | "left" | "right"}
  • {"action": "type", "text": "..."}
  • {"action": "open", "app": "..."}
  • {"action": "set_time", "time": "07:00"}
  • {"action": "back"} · {"action": "home"} · {"action": "wait"} · {"action": "key"}

Supported outcome suffixes: -> screen changed, -> screen did NOT change, or -> unknown.

Value Meaning Coordinates (point / box)
TAP Tap the target UI element Present when present_prob and box are valid
TYPE Enter text into the active or targeted field (caller supplies the text string) Optional target input box
KEY Press a keyboard key or shortcut such as Return or Backspace (caller supplies the key) null or optional target
SWIPE_UP Scroll content upward (finger moves bottom → top) Optional start box; default full-screen swipe
SWIPE_DOWN Scroll content downward (finger moves top → bottom) Optional start box; default full-screen swipe
SWIPE_LEFT Swipe left (for carousels, tabs, or pages) Optional start box; default horizontal swipe
SWIPE_RIGHT Swipe right (for carousels, tabs, or back gesture) Optional start box; default horizontal swipe
HOME Return to the phone’s Home screen null
BACK Navigate back (Android Back key or iOS back action) null
WAIT Wait briefly for a loading screen or animation to settle null
DONE The goal is complete on the current screen null
OPEN Launch an app directly by name / Spotlight / adb intent (caller supplies app name) null
Value Meaning
"step 1" .. "step 999" The 1-indexed line in plan that the model is currently executing
"done" All planned steps for goal have been satisfied
"other" An off-plan screen is blocking progress (for example a permission prompt, cookie sheet, or pop-up dialog)
  • "manina-act-1"
200 OK
{
"id": "act_2f7c9a1e0b6d4f3a",
"op": "TAP",
"op_prob": 0.93,
"step": "step 2",
"step_prob": 0.88,
"step_text": "Tap Wi-Fi",
"box": [239, 478, 717, 956],
"point": {"x": 478, "y": 717},
"present_prob": 0.97,
"confidence": 0.91,
"plan": "1. Open Settings\n2. Tap Wi-Fi",
"image": {"width": 1290, "height": 2796},
"latency_ms": 284,
"model": "manina-act-1"
}
Field Type Description
id string Unique request identifier (act_ followed by 16 hex characters).
op string Predicted UI operation (one of the 12 op enum values above).
op_prob number 0 to 1: model probability assigned to op.
step string "step N", "done", or "other".
step_prob number | null 0 to 1: model probability assigned to step.
step_text string Text of the matched plan line (empty when done or other).
box integer[4] | null [x1, y1, x2, y2] in original image pixels, or null when step is "done" or no spatial target applies.
point object | null {"x": integer, "y": integer} centre of box in original image pixels, or null.
present_prob number | null 0 to 1: target visibility score when box is returned, else null.
confidence number | null 0 to 1: spatial certainty of box, else null.
plan string Normalized numbered plan evaluated by the server.
image object {"width": integer, "height": integer} of your decoded screenshot.
latency_ms integer Server processing duration in milliseconds.
model string "manina-act-1".
  • Confidence gating: Execute TAP, directional swipes, and BACK automatically only when op_prob >= 0.7 and (for TAP) present_prob >= 0.5 and confidence >= 0.5. Hand lower-confidence steps back to your planner or user.
  • Pop-up recovery (step: "other"): Allow the model to dismiss unexpected dialogs when confidence is high, but cap consecutive "other" steps (for example at 5 in a row) before replanning.
  • Sensitive actions: Never auto-confirm payments, transfers, message sends, or deletions without explicit user approval.
  • Errors & rate limits: See Error codes & rate limits.