Agent Optimize
by api.zendiq.ai in Onchain & crypto
Solana swap execution for AI agents. Returns an UNSIGNED swap transaction on the best venue after fees, Jito tip and expected sandwich loss, with the plan, a simulation and the net-benefit arithmetic to verify before signing, plus the same Safe / Protect / Refuse verdict as /analyse. Needs taker: the mainnet wallet that signs and funds the trade. Never signs or holds keys. Full contract: GET /v1/agent. Terms: https://zendiq.ai/agents/terms/
https://api.zendiq.ai/v1/agent/optimize- Price
- $0.02
- per call in USDC
- Uptime
- 100%
- last 30 days
- Response time
- 443 ms
- 871 ms slowest 5%
- Last check
- Passed
- 3 h ago, next any minute now
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://api.zendiq.ai/v1/agent/optimize
Each call costs $0.02 in USDC on Solana, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
POST https://api.zendiq.ai/v1/agent/optimize
content-type: application/json
{
"amount": "1000000",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"taker": "BS9DnoBnndNj6QmeEbH2mxizefWYyrLond5G8bKUYxHC"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | string | Yes | Amount sold, as an integer string in the input mint's atomic units. |
analysisId | string | No | Optional. analysisId from /analyse or /analyse-token for this outputMint, within 60 s, to skip the token scan. |
inputMint | string | Yes | Base58 mint of the token being sold. |
outputMint | string | Yes | Base58 mint of the token being bought. Must differ from inputMint. |
slippageBps | integer | No | Optional. Omit to let the router decide. |
taker | string | Yes | Mainnet wallet that signs the trade and holds the input amount; not the wallet paying for the call. |
Example response
The provider's example. We can't check it without paying.
{
"custody": "none - transaction is unsigned; sign and submit with your own wallet",
"plan": {
"choice": "selected",
"venue": "jupiter_ultra"
},
"simulation": {
"status": "ok"
},
"submit": {
"method": "jupiter_ultra_execute"
},
"transaction": "<base64 unsigned VersionedTransaction>",
"verdict": "Safe"
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.02.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://api.zendiq.ai/v1/agent/optimize' \
-H 'content-type: application/json' \
--data-raw '{"amount":"1000000","inputMint":"So11111111111111111111111111111111111111112","outputMint":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","taker":"BS9DnoBnndNj6QmeEbH2mxizefWYyrLond5G8bKUYxHC"}'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://api.zendiq.ai/v1/agent/optimize' \
-H 'content-type: application/json' \
--data-raw '{"amount":"1000000","inputMint":"So11111111111111111111111111111111111111112","outputMint":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","taker":"BS9DnoBnndNj6QmeEbH2mxizefWYyrLond5G8bKUYxHC"}' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/svm @solana/kit @scure/base
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactSvmScheme } from "@x402/svm/exact/client";
import { createKeyPairSignerFromBytes } from "@solana/kit";
import { base58 } from "@scure/base";
// Pays at most $0.02 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.02" });
registerExactSvmScheme(client, { signer: await createKeyPairSignerFromBytes(base58.decode(process.env.SVM_PRIVATE_KEY)) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.02 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.zendiq.ai%2Fv1%2Fagent%2Foptimize&method=POST
const res = await pay("https://api.zendiq.ai/v1/agent/optimize", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"amount": "1000000",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"taker": "BS9DnoBnndNj6QmeEbH2mxizefWYyrLond5G8bKUYxHC"
}),
});
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,svm]"
import os
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.svm import KeypairSigner
from x402.mechanisms.svm.exact.register import register_exact_svm_client
# Pays at most $0.02 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.02"})
register_exact_svm_client(client, KeypairSigner.from_base58(os.environ["SVM_PRIVATE_KEY"]))
with x402_requests(client) as session:
res = session.post(
"https://api.zendiq.ai/v1/agent/optimize",
json={
"amount": "1000000",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"taker": "BS9DnoBnndNj6QmeEbH2mxizefWYyrLond5G8bKUYxHC",
},
)
print(res.status_code, res.text)Security scan
No findings
We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 3 h ago | Passed | 402 | 537 ms | $0.02 |
| 8 h ago | Passed | 402 | 395 ms | $0.02 |
| 12 h ago | Passed | 402 | 758 ms | $0.02 |
| 17 h ago | Passed | 402 | 427 ms | $0.02 |
| 21 h ago | Passed | 402 | 383 ms | $0.02 |
Show 10 older checks
| 25 h ago | Passed | 402 | 400 ms | $0.02 |
| 29 h ago | Passed | 402 | 387 ms | $0.02 |
| 34 h ago | Passed | 402 | 776 ms | $0.02 |
| 38 h ago | Passed | 402 | 663 ms | $0.02 |
| 42 h ago | Passed | 402 | 379 ms | $0.02 |
| 46 h ago | Passed | 402 | 443 ms | $0.02 |
| 2 days ago | Passed | 402 | 485 ms | $0.02 |
| 2 days ago | Passed | 402 | 455 ms | $0.02 |
| 2 days ago | Passed | 402 | 402 ms | $0.02 |
| 3 days ago | Passed | 402 | 443 ms | $0.02 |