Guide · Pay from NEAR
Pay from NEAR
An agent on NEAR pays for inference with the USDC it holds there. NEAR Intents 1Click moves it to USDC on Base at the agent's own address in about 22 seconds. Each call is then paid with x402, with no key, no gas and no account with us.
The path
| Step | Where | What happens |
|---|---|---|
| 1 | Your agent | Hold one address of its own on Base. It receives the USDC and signs x402 payments. It never needs gas money. |
| 2 | NEAR Intents 1Click | Quote USDC on NEAR to USDC on Base, delivered to that address. |
| 3 | NEAR | Send the quoted amount to the deposit address with the venue's own transfer. |
| 4 | Base | About 22 seconds later the USDC is at your address. |
| 5 | coord.taifoon.dev | Call /v1/chat/completions. It answers 402 with x402 terms; your client signs one authorization and the call is answered and settled. |
1. Hold an address of your own on Base
recipient = the buyer's own EVM address on Base (any secp256k1 key it keeps, or an address derived with NEAR chain signatures); that address then signs the x402 authorization.
2. Quote the move from NEAR
Ask NEAR Intents 1Click what it takes to deliver exactly 1 USDC on Base to your address. With "dry": true nothing is reserved and nothing is paid:
curl -X POST https://1click.chaindefuser.com/v0/quote -H "content-type: application/json" -d '{
"dry": true,
"swapType": "EXACT_OUTPUT",
"slippageTolerance": 100,
"originAsset": "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1",
"depositType": "ORIGIN_CHAIN",
"destinationAsset": "nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near",
"amount": "1000000",
"refundTo": "your-agent.near",
"refundType": "ORIGIN_CHAIN",
"recipient": "0xYourBaseAddress",
"recipientType": "DESTINATION_CHAIN",
"deadline": "2026-12-31T00:00:00Z"
}'Read on 2026-10-22T18:04:40Z: amountIn 1012733 (min 1002605) → amountOut 1000000, timeEstimate 22 s, withdrawFee 2400, refundFee 6103, correlationId e6db90bf-b016-4977-9b7b-f184856f6179; first read 17:48:42Z (coord tasks/web-near-pay-door.md). Amounts are in units of 0.000001 USDC.
Fees: in the quote: withdrawFee and refundFee in USDC units, a 1 bps app fee without a 1Click partner key; 1.0127 USDC on NEAR for exactly 1 USDC on Base (2026-10-22).
3. Pay from NEAR
Send the same request with "dry": false. The answer adds quote.depositAddress and quote.deadline. Send quote.amountIn of USDC on NEAR to that address before the deadline. The token contract is 17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1, and a transfer attaches exactly 1 yoctoNEAR:
near contract call-function as-transaction \
17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1 ft_transfer \
json-args '{"receiver_id":"<quote.depositAddress>","amount":"<quote.amountIn>"}' \
prepaid-gas '30.0 Tgas' attached-deposit '1 yoctoNEAR' \
sign-as your-agent.near network-config mainnet sign-with-keychain sendIf storage_balance_of on the token contract returns null for the deposit address, register it first with storage_deposit. Then report the transaction so the move starts at once, and follow it:
curl -X POST https://1click.chaindefuser.com/v0/deposit/submit -H "content-type: application/json" \
-d '{"txHash":"<your tx hash>","depositAddress":"<quote.depositAddress>"}'
curl "https://1click.chaindefuser.com/v0/status?depositAddress=<quote.depositAddress>"| status | Means |
|---|---|
PENDING_DEPOSIT | Nothing has arrived at the deposit address yet. |
PROCESSING | The money arrived and is being moved to Base. |
SUCCESS | It is at your address. swapDetails.destinationChainTxHashes holds the transaction. |
REFUNDED | The quote could not be filled before its deadline. The money went back to refundTo. |
4. Call, paid with x402
Without a key the call answers 402. The PAYMENT-REQUIRED header holds the terms: one exact entry per network the door settles, the amount, and the address that is paid. Pick the entry for eip155:8453 (Base, USDC). You never type the payee: it is read from the challenge.
curl -i -X POST https://coord.taifoon.dev/v1/chat/completions \
-H "content-type: application/json" \
-d '{"model":"llama-3.3-70b","messages":[{"role":"user","content":"hello"}],"max_tokens":64}'Any x402 v2 client pays it. In TypeScript, with the key of the address that holds the USDC:
import { wrapFetchWithPaymentFromConfig } from '@x402/fetch';
import { ExactEvmScheme } from '@x402/evm';
import { privateKeyToAccount } from 'viem/accounts';
const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: 'eip155:8453', client: new ExactEvmScheme(account) }],
});
const r = await pay('https://coord.taifoon.dev/v1/chat/completions', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({"model":"llama-3.3-70b","messages":[{"role":"user","content":"hello"}],"max_tokens":64}),
});
console.log(await r.json()); // an OpenAI chat completionThe client signs one transfer authorization (EIP-3009). The facilitator settles it and pays the gas, so the address holds the dollar token only.
A key is free and not needed to pay with x402. A call sent with a key is paid from that key's balance; a call sent without one is paid with x402. Each model also has its own path, /v1/chat/completions/<model>. Prices lists every priced wall.
What it takes
- a NEAR account holding USDC on NEAR
- one ft_transfer with 1 yoctoNEAR attached and ~30 Tgas (NEAR's own fee, in NEAR)
- storage_deposit for the 1Click deposit address when storage_balance_of is null (~0.00125 NEAR)
- one EVM address of its own to receive USDC on Base and sign the x402 authorization (no ETH needed)
Nothing from Taifoon: no key, no registration, no account and no spec before the first paid call. The money lands per call in vault:taifoon:kms.
How this was checked
1Click POST /v0/quote dry:true, EXACT_OUTPUT 1000000 to a buyer's own Base address; and the door's 402 on eip155:8453 (read 2026-10-22T18:04:40Z). Proven by a quote or a challenge: yes. Quotes and challenges only: nothing was deposited, signed or paid to check this page.