AntSeed inference in GenLayer Studio
Use AntSeed as an inference provider inside GenLayer Studio validators.
What GenLayer Studio is. Studio runs Intelligent Contract validators that consult LLMs to reach consensus. Each validator is configured with a provider entry that has a provider name, a plugin (one of openai-compatible / anthropic / google / ollama / custom), a model id, and a plugin_config with api_url and api_key_env_var.
How AntSeed plugs in. Drop one JSON file per model into backend/node/create_nodes/default_providers/ with plugin: "openai-compatible" and api_url: "http://host.docker.internal:8377". Studio's openai-compatible plugin appends /v1/chat/completions automatically, so the buyer proxy receives a standard OpenAI Chat request and routes it to your pinned peer. Mirror the existing LibertAI entry (PR #1526) - it is the closest analogue: an openai-compatible host with a hosted base URL replaced by your local proxy.
Why host.docker.internal, not localhost. Studio's backend runs in Docker via genlayer up. From inside the container, localhost means the container itself, not your host machine - it cannot reach the AntSeed buyer proxy on the host. Mac/Windows Docker exposes the host as host.docker.internal; on Linux you must add extra_hosts: ["host.docker.internal:host-gateway"] to the backend service in docker-compose.yml or run with --network=host.
Run AntSeed first
Every integration assumes a buyer proxy at http://localhost:8377. One-time setup, ~2 minutes.
Before you start
Prerequisites
- GenLayer Studio cloned and running locally with
genlayer up(see https://docs.genlayer.com/developers/intelligent-contracts/tools/genlayer-studio)
Step 1
Install GenLayer Studio
- On Linux only - make `host.docker.internal` resolve from inside the backend container# docker-compose.yml - patch the backend (jsonrpc) service services: jsonrpc: extra_hosts: - "host.docker.internal:host-gateway"
Mac and Windows Docker Desktop already expose the host as
host.docker.internalautomatically - skip this step on those platforms. Restart withgenlayer up --resetafter editing.
Step 2
Point GenLayer Studio at AntSeed
Both schema files must be kept in sync - the backend uses one for validation, the frontend uses the other for the UI dropdown. This is exactly what PR #1526 did for LibertAI.
Step 3
Pick a model
Each provider JSON file pins exactly one model. Studio enumerates these into the validator-creation UI; pick services you know your pinned peer offers (check antseed network peer <peerId> --json | jq '.matchingServices[].service'). To expose more models later, drop in more antseed_<model>.json files - no schema edit needed. To lock a file to one specific peer, set model to <peerId>@<service-id>.
The exact list of models depends on which peer you pin. Run antseed network browse or open the live network page to see what's available right now.
Verify
Test it
- Restart Studio so it re-scans `default_providers/`genlayer up --reset
get_default_providers()inbackend/node/create_nodes/providers.pyreads every*.jsonin that folder once on boot, validates againstproviders_schema.json, and caches the result. Schema-validation errors abort startup with the offending file path - watch the logs. - In the Studio UI, create a new validator with provider "antseed"
You should see your
antseed_*.jsonmodel ids in the dropdown. Save and trigger a contract that callsgenlayer.eq_principle.prompt(…)- the request hitshttp://host.docker.internal:8377/v1/chat/completionson the AntSeed proxy and is forwarded to your pinned peer. - Confirm the validator call hit AntSeedantseed buyer metering
Each validator call adds tokens + USDC to the channel for the peer you pinned. Run after a Studio request to see the totals update. To poll live:
watch -n 1 antseed buyer metering.
How GenLayer Studio talks to AntSeed
- Wire format sent by GenLayer Studio:
OpenAI Chat Completions(hits/v1/chat/completionson the buyer proxy) - Best-fit services: any service whose
protocolsarray containsopenai-chat-completions. That's what the peer advertises as natively-supported - zero translation overhead, no transform edge cases. - How to check a peer: run
antseed network peer <peerId> --jsonand look atproviderServiceApiProtocols[provider].services[service]. The browse command exposes the same field per peer. - What happens when protocols don't match: AntSeed's
@antseed/api-adaptertranslates between OpenAI Chat Completions and the service's native protocol on the fly. So a request from GenLayer Studio can still reach a service that only advertisesanthropic-messages- just with a small transform step. - One known caveat: services whose only advertised protocol is
openai-responsesrequire streaming. If GenLayer Studio sends a non-streaming request and the proxy routes it to one of those services, the call fails withHTTP 400: Stream must be set to true. Pick a service whoseprotocolsincludesopenai-chat-completions(or another non-responses protocol) to avoid this.
If it goes wrong
Troubleshooting
Error validating file … antseed_*.jsonongenlayer upThe schema rejected your provider JSON. Most common cause: missing the if/then rule forprovider:antseed, so it falls through with the wrongplugin. Add the rule to *both*backend/.../providers_schema.jsonandfrontend/.../providers_schema.json. Rungenlayer up --resetafter editing.- Validator hangs, then errors with
Connection refusedtohost.docker.internal:8377The backend container can't see your host. On Linux, addextra_hosts: ["host.docker.internal:host-gateway"]under the backend service indocker-compose.yml(see install step 2). On Mac/Windows, confirm Docker Desktop is running and the AntSeed proxy is up:curl http://host.docker.internal:8377/v1/modelsfrom inside the container withdocker compose exec jsonrpc curl …. - Validator returns
no_peer_pinnedNo peer is pinned in the buyer proxy. Runantseed network browse, pick one, thenantseed buyer connection set --peer <peerId>. Alternatively, send a per-requestx-antseed-pin-peerheader by extending the openai-compatible plugin - not currently exposed in the standard schema, so session pin is the path of least resistance. 404 model_not_foundfrom a validator using e.g.kimi-k2.6Your pinned peer doesn't advertise that service id. Runantseed network peer <peerId> --json | jq '.matchingServices[].service'to see what it does serve. Either pin a different peer or remove thatantseed_<model>.jsonfile.- First call after a restart takes 5–15 secondsAntSeed opens a payment channel on the first request to a new peer (one Base-mainnet transaction). Subsequent calls reuse the channel. Pre-warm with
curl -s http://localhost:8377/v1/chat/completions -d '{"model":"<id>","messages":[{"role":"user","content":"hi"}]}'before triggering Studio.
Heads up
Caveats
- AntSeed is a local daemon, not a hosted endpoint. Every Studio operator must run the VPR or
antseed buyer starton their own machine and fund their wallet - there is no central account. - Free services exist on the AntSeed network (
in: 0, out: 0), but using paid ones requires a USDC deposit on Base. The VPR guides users through this on first launch; the CLI exposes it asantseed payments.
Reference
Links
Same category