Skip to main content
Base URL: https://api.chipipay.com/v1

When to use

/ai/think and /ai/execute work together to power autonomous DeFi agents. Think decides what to do; Execute builds the how.

What you can build

  • Autonomous DeFi agent — /think runs on a schedule (hourly, daily), if it says swap → /execute builds the swap → your agent signs and submits via session key. Fully automated, gasless.
  • Portfolio advisor app — Show users a dashboard with AI recommendations. /think with their real balances + chosen risk level. They review the suggestion and approve manually.
  • Risk-managed vault — A smart contract-backed strategy where /think enforces risk params (max drawdown, min stablecoins) before any rebalance.
  • Telegram trading bot — User sends portfolio snapshot, bot calls /think, replies with the recommendation and a “execute” button that triggers /execute.
  • Yield optimizer — /think includes DeFi yield data from DefiLlama. An agent can compare swap gains vs. yield APY and pick the better move.
/think automatically fetches live signals (RSI, MACD, Fear & Greed, yields) — you don’t need to call /signals first. Just send the portfolio.

POST /ai/think

DeFi portfolio advisor. Analyzes your portfolio with real-time market signals (RSI, MACD, Fear & Greed, yields) and returns a structured JSON decision: swap, supply, withdraw or hold, with confidence and reasoning. Cost: Per token (same as /chat — the model call is the cost)

Request body

Risk parameter overrides

All optional. Defaults scale linearly with riskScore. Override any individual param without affecting others.

How risk scoring works

Risk parameters scale with riskScore from conservative (1) to aggressive (10):
The /think endpoint automatically injects live market data (signals, yields, Fear & Greed) into the AI prompt. You don’t need to fetch signals separately — just send the portfolio and risk score.

POST /ai/execute

Build unsigned swap calldata from AVNU (Starknet DEX aggregator). Returns the transaction calls — you sign and submit via session key or wallet. Cost: $0.002 per call (flat, not per token)

Request body

/execute returns unsigned calls. It does NOT submit the transaction. You sign with your wallet or session key and submit via the Chipi paymaster (gasless). Swaps with more than 3% price impact are rejected.

Putting it together: Think + Execute

A typical DeFi agent flow:
  1. Think — send portfolio + risk score, get a decision
  2. If the decision is swap → Execute — get unsigned swap calldata
  3. Sign the calls with your wallet or session key
  4. Submit via Chipi’s gasless paymaster

With the SDK (14.14.0+)

@chipi-stack/backend wraps these endpoints as sdk.ai. It authenticates with your secret key and refuses to run without one, so it is server-only.
API errors throw ChipiApiError with the API’s code and status, for example INSUFFICIENT_BALANCE (402), MODEL_RATE_LIMITED (429) or SIGNALS_UNAVAILABLE (503).
✅ Verified against the packed 14.14.0 types on 2026-09-28.