Agents

An agent needs a base URL, a router key and one approval from you. It never holds a NEAR key, and it can't spend past the daily limit you set on chain.

$
  1. Ask your human for a key

    Start the device flow with a name they will recognise and the daily limit you want. Show them the link or the QR it returns.

    export MERIDIAN=https://www.tradeonmeridian.xyz
    curl -sS -X POST $MERIDIAN/api/v1/device \
      -H 'content-type: application/json' \
      -d '{"name":"claude-code on my laptop","cap_usd_micro":"5000000"}'
  2. Wait for the approval

    They open the link with a NEAR wallet and set your daily limit on chain. Poll every interval seconds. The key arrives once, so store it.

    curl -sS $MERIDIAN/api/v1/device/$DEVICE_CODE
    {"status":"approved","key":"rk_...","key_id":"..."}
  3. Point your client at Meridian

    The router speaks the OpenAI Chat Completions API and takes the cheapest live ask for the model you name.

    export OPENAI_BASE_URL=$MERIDIAN/api/v1
    export OPENAI_API_KEY=rk_...
    curl -sS $OPENAI_BASE_URL/chat/completions \
      -H "authorization: Bearer $OPENAI_API_KEY" \
      -H 'content-type: application/json' \
      -d '{"model":"glm-5.3","messages":[{"role":"user","content":"hello"}]}'
  4. Buy ahead, sell what you don't use

    Lock in today's price with a buy. Requests spend those MTokens first, and whatever is left sells back into the bids.

    curl -sS -X POST $MERIDIAN/api/v1/trades \
      -H "authorization: Bearer $OPENAI_API_KEY" -H 'content-type: application/json' \
      -d '{"model":"glm-5.3","tokens":"1000000"}'
    curl -sS -X POST $MERIDIAN/api/v1/sells \
      -H "authorization: Bearer $OPENAI_API_KEY" -H 'content-type: application/json' \
      -d '{"model":"glm-5.3","tokens":"500000"}'

Try it without a wallet

This deployment hands out demo keys at once. They spend from a shared house wallet under one daily limit for everyone.

curl -sS -X POST $MERIDIAN/api/v1/device \
  -H 'content-type: application/json' \
  -d '{"name":"trying meridian","demo":true}'
{"key":"rk_...","key_id":"..."}

When the money runs out

The router answers 403 when today's limit is spent and 402 when the wallet is empty, each with a link and a QR. Show it to your human, poll until it clears, then retry. Never ask them for a private key.

Every endpoint, field and error is in skill.md, written for agents to read. Humans approve agents and set limits on the Wallet page.

Connect a wallet

Ethereum

Get MetaMask

Solana

Get Phantom

NEAR