TorqueTorque

Search docs

Search Torque documentation pages & sections

Assistant

DECIDE: chat → functionResults Actions. sk_live_… server-side (Authentication).

Key Rule

All inputs, regardless of modality, are transformed into a single decision output.

Any input mode
TextChatVoice

Same DECIDE pipeline for every modality

DECIDE

Intent → Financial Action draft

functionResults; no settlement

Execution Flow

Call

Server calls POST /assistant/chat with sk_live_… + wallet context

DECIDE
contentfunctionResults

Assistant returns one of two shapes

Read-only answer; prepared transactions

Confirm

Hosted confirm (/connect/execute) or Connect OAuth approval

EXECUTE

User signs & POSTs /execute/** with wallet or delegated JWT

Consumer prompt examples in the Examples section below.

API Reference

At a Glance

Preferred routePOST /api/v1/decide/assistant/chat
Legacy aliasPOST /api/v1/assistant/chat (same handler)
Auth (programmatic)Authorization: Bearer sk_live_…
Streaming?stream=true → SSE (text/event-stream)
Client executes txstrue: functionResults → Actions API

Authentication

CallerRequirement
Programmatic / serverAuthorization: Bearer sk_live_… required
In-app browser (Torque origins)May call without business key
Free tier (wallet in context)20 messages / 30 days → 402 assistant_credits_exhausted

walletAddress preloads portfolio (Profile B). Do not call /assistant/functions; internal to chat.

Request Body

AssistantChatPostBody
{
  "messages": [
    { "role": "user", "content": "What is the price of ETH?" }
  ],
  "context": {
    "walletAddress": "0x…",
    "solanaWalletAddress": "…",
    "chainId": 8453,
    "localCurrency": "USD",
    "authJWT": "<smart_wallet_jwt>"
  },
  "conversationId": "optional-thread-id"
}

Required: messages. Context: walletAddress, chainId, authJWT for portfolio & tx drafts.

Response (JSON)

response.json
{
  "content": [
    { "type": "text", "text": "Here's the best route I found…" }
  ],
  "functionResults": [
    {
      "toolName": "swap_tokens",
      "result": {
        "success": true,
        "requiresConfirmation": true,
        "tokenIn": "USDC",
        "tokenOut": "ETH",
        "amountIn": "100",
        "chainId": 8453,
        "transaction": { … }
      }
    }
  ]
}

functionResults is omitted when empty. Read-only tools return answers in content only.

functionResults by Tool

toolNameKey Result Fields
swap_tokenstokenIn, tokenOut, amountIn, chainId, transaction, …
transfer_tokenstoken, amount, recipient, chainId, transaction
lend_tokenstoken, amount, protocol, chainId, transaction
borrow_tokenscollateralToken, borrowToken, amounts, protocol, …
get_portfolio_summaryUnified portfolio buckets; Profile B integrators only

Signable (swap_tokenstransfer_tokenslend_tokensborrow_tokens) set requiresConfirmation: true; hand off via Connect or submit with a wallet JWT on Actions. Advisory (get_portfolio_summaryget_yield_opportunities) return context in content only.

Streaming

Append ?stream=true for Server-Sent Events.

Event TypePayload
delta{ text }: incremental assistant text
correction{ text }: full text replacement
done{ functionResults }: final tool payloads
error{ message }
(terminal)data: [DONE]
assistant-chat.sh
curl -sS -N -X POST "https://app.torque.fi/api/v1/assistant/chat?stream=true" \
  -H "Authorization: Bearer $TORQUE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [{ "role": "user", "content": "Trade 100 USD for ETH on Base" }],
    "context": { "walletAddress": "0x…", "chainId": 8453 }
  }'

Examples

Plain-language prompts → lookup, quote, or draft. Fund moves require confirmation.

Track

  • “What's my net worth?”: total value and category breakdown
  • “Show my assets on Base”: balances and USD value for one chain
  • “What's the price of ETH?”: spot price and 24h change

Trade

  • “Trade 100 USD for ETH on Base”: best route, output, and price impact
  • “Bridge 500 USD from Ethereum to Base”: bridge route, ETA, and fees

Transfer

  • “Send 0.5 ETH to vitalik.eth”: drafted transfer ready to confirm
  • “Request 100 USD from alice@example.com”: payment request link
  • “Create an invoice for 250 USD”: shareable invoice for a client

Lend

  • “What are USD lending rates?”: current APYs across supported markets
  • “Lend 1000 USD”: supply draft at the best available rate
  • “Show my lending position”: supplied assets and accrued interest

Supported supply assets include USDC, USDT, DAI, ETH, and other markets listed in Assets. APYs are variable and depend on utilization.

Borrow

  • “Borrow 500 USD against my ETH”: draft loan against collateral
  • “What is my health factor?”: liquidation risk for open borrows
CollateralMax LTV
ETH80%
USDC85%
WBTC75%

Keep health factor above 1.0 to avoid liquidation. Below 1.5 warrants close monitoring.

Sample Conversation

You: Trade 100 USD for ETH on Base

Assistant: Here's the best route I found.
  • You pay:     100 USD (USDC on Base)
  • You receive: ~0.0287 ETH
  • Price impact: 0.03%
  • Network fee:  sponsored
Confirm to send?

You: confirm

Assistant: Done. 0.0287 ETH is in your Base wallet.
Transaction: 0x4f2a…c19b
Was this helpful?