Onchain Routerby AgenticFI Base Mainnet

Developer documentation

Text generation & Messages

Two familiar request formats for the same text capability.

Page tools

Choose a format, not a different provider

POST /v1/chat/completions accepts OpenAI-compatible messages and returns choices. POST /v1/messages accepts Anthropic-compatible messages and returns content blocks. Both use the same enabled text models and USDC payment lifecycle.

Choose Chat Completions for an OpenAI-style client; choose Messages for an Anthropic-style client. Neither format means that OpenAI or Anthropic models are currently offered. Gemini serves the current text catalog.

Models and parameters

Read models for compatible IDs and limits. Supply an explicit model, messages, and an output-token request within that model's advertised limits. Text supports the documented vision, tools, and structured-output shapes. Streaming is not available.

Start with Chat Completions or Messages. Text uses a fixed exact request price based on conservative input estimation, 10% of requested output, and published fees. Provider-reported usage remains visible in the receipt.

Truncation and recovery

A finish_reason of length can be a successful, charged but truncated answer. If you intentionally request a longer answer, that is a new logical request with a new key and authorization. Do not change the body under the old key.

Lost responses and ambiguous outcomes must follow the original request's recovery directive. Automatic model selection is experimental source-only; the public endpoint does not silently choose a provider for you.

Reviewed 2026-08-31Catalog c1f92fac4f1d

Search guides, endpoint references, models, and pricing.