# Connect an autonomous agent safely

The portable Agent Skill is available at `/skill/onchain-router/SKILL.md`. It teaches an agent how to discover available models, enforce spending limits, pay with official x402 libraries, and return both the answer and its receipt.

## Discovery order

1. Read `/llms.txt` for a short, curated map of the website and its authoritative resources.
2. Read `/llms-full.txt` when the agent needs the complete public documentation in one request instead of visiting each page separately.
3. Read `/v1/models` to get the current capability categories, model aliases, limits, and compatible endpoints.
4. Read `/v1/pricing` for detailed rates and `/v1/audio/voices` before a text-to-speech request.
5. Read `/openapi.json` to get the machine-readable request and response contract for all nine public routes.
6. Submit the request and treat Hypertext Transfer Protocol (HTTP) status 402 as the expected payment step.
7. Check every live payment field before signing.

## Endpoint selection

- Use `/v1/chat/completions` for OpenAI-compatible text and `/v1/messages` for Anthropic-compatible text.
- Use `/v1/images/generations` for an image, `/v1/audio/speech` for an MP3, and `/v1/audio/transcriptions` for a transcript.
- Use `/v1/models`, `/v1/pricing`, `/v1/audio/voices`, and `/v1/balance` for free discovery. They must never ask the agent to sign.

Read the [endpoint overview](https://llm.agenticfi.wtf/docs/endpoints) for the exact public surface and the generated endpoint guides for request-specific fields.

The `llms.txt` convention is an emerging discovery convention rather than an access-control standard. The website also publishes `/sitemap.xml`, per-page Markdown alternatives, and HTML discovery links. Access and indexing policy remain in `/robots.txt`.

## Required local policy

- Base mainnet only (`eip155:8453`); reject every other network.
- Dedicated, minimally funded mainnet wallet only.
- Limits for each request and each session, represented as integer atomic United States Dollar Coin (USDC) strings.
- Explicit model allowlist.
- Recipient and USDC contract allowlists.
- No payer registration: any wallet with a valid facilitator-verified authorization may pay.
- One stable idempotency key across the unpaid request and the signed retry so the service can prevent duplicate work.
- No blind retry after provider or settlement ambiguity.

## Stable output

Return the requested text, image, audio, or transcript; the selected model; normalized usage; approved maximum; final amount charged; payment asset; network; receipt identifier; and transaction hash. For hosted media, also return the exact expiry field. Hide large provider-specific reasoning fields unless the caller explicitly requests the raw response.

## Install

Copy the `skills/onchain-router` directory into the Agent Skills location supported by the caller. Keep the package lockfile and official x402 dependencies with the executable scripts. Do not add a wallet key to the skill folder.
