Skip to content
Fossa

Self-hosting

Run your own indexer API for compatible clients, with local protocol data and live updates.

Run the standalone indexer to provide protocol data to OpenCode or another compatible Fossa integration. It reads public Solana state, maintains a catalog, and supplies wallet and booking information. Your client keeps its signing keys and sends inference directly to providers.

You control the data service and its stored records. You still need network access, available providers, and a funded wallet. This service does not run models or expose the OpenAI-compatible chat API used by generic clients.

Install

Use Git and a Rust toolchain to clone and build the indexer. Copy the example configuration, then complete Configure before starting the service.

Configure

Edit .env with your Solana RPC URL and one account stream for the same network. The RPC supplies snapshots and transaction access; the stream supplies account changes.

VariablePurpose
FOSSA_RPC_URLSolana RPC endpoint. Required.
FOSSA_WS_URLWebSocket account stream.
FOSSA_GRPC_URLAlternative Yellowstone Geyser stream. Takes precedence over WebSocket when both are set.
FOSSA_GRPC_TOKENStream credential, when required by your service.
FOSSA_PUBLIC_URLOrigin clients use to reach this indexer.

The example configuration contains protocol defaults. For another deployment, change the program, market, provider list, payment mint, and full genesis hash together. The list must belong to that market. Use a separate database for each network, protocol identity, or commitment.

The default listener is 127.0.0.1:8790. The database is state/indexer.sqlite, relative to the working directory. Existing environment variables take precedence over .env. Keep endpoint credentials private.

For large provider-limit bookings, FOSSA_PROVIDER_LIMIT_LOOKUP_TABLES accepts comma-separated lookup-table addresses. Compatible clients receive these addresses through the public configuration.

Start and check readiness

Start the binary with your environment file. From another terminal, read /health. HTTP 200 means the indexer is ready; HTTP 503 means it is synchronizing or its data is stale. Wait for readiness before using the catalog.

A restart requires fresh reconciliation. The account sources and referenced metadata must remain available, and invalid metadata excludes the affected offers. confirmed is the default account commitment; use finalized for stronger finality. Receipt history uses finalized transactions in either case.

Connect a client

In OpenCode, run /fossa and select API endpoint in Fossa Settings. Enter the origin where your indexer is reachable. Then run /connect, choose Fossa, and import a wallet key for that endpoint. Keys remain encrypted on your computer. Fund the wallet separately with USDC for inference and SOL for network fees and storage.

For remote access, serve HTTPS, set FOSSA_PUBLIC_URL to that origin, and keep the local listener private behind the HTTPS entry point. Changing the endpoint requires a wallet connection for the new endpoint.

The indexer supports manual key import. Website approval, website funding pages, and sponsored transactions remain hosted-service features. A generic client configured only for Chat Completions cannot use the indexer as its inference endpoint; it needs a native integration.

Available data

The indexer exposes a compatible Fossa client API:

EndpointPurpose
GET /v1/configPublic protocol identities and client settings.
GET /v1/market/catalogVerified model metadata and offers for the configured list.
GET /v1/market/listsList discovery.
GET /v1/opencode/walletAuthenticated wallet state and transaction-fee estimates.
GET /v1/opencode/fundsFree funds and eligible expired reservations.
GET /v1/opencode/receiptsArchived receipt summaries.
GET /v1/opencode/liveAuthenticated catalog, wallet, booking, fee, and receipt updates.
POST /v1/opencode/rpcAllowlisted reads, transaction simulation, and signed relay.

Catalog reads are public. Wallet access requires a signed challenge, which the client handles. The indexer stores session-token hashes and indexed records; wallet signing keys stay with the client.

OpenCode receives priority-fee estimates from the indexer. Fresh gRPC samples take priority, with an RPC fallback and a positive fee floor when estimates are unavailable. The client does not need its own gRPC connection.

The relay accepts signed legacy and v0 transactions for a bounded set of programs. The authenticated wallet must be the payer. Authenticated unsigned simulation is also supported. The relay does not authorize general DEX or Token-2022 transactions; clients can use separate chain access for those operations.

Freshness and metadata

Use offers only while the catalog is ready. Metadata verification establishes that a document matches its committed identity; it does not prove the provider’s model execution or data handling. Missing or stale data cannot establish current availability.

The configured list determines routing. List discovery does not change that selection. Existing bookings retain their agreed rates and payment destinations when offers, list membership, or model assignments change. See indexing requirements.

Receipts and accounting

Receipt history records successfully executed claims retrieved from finalized transactions. Older transactions may be unavailable, so the history can be incomplete. Preserve coverage gaps and the original booking terms; current list membership cannot establish a historical booking’s list.

Live receipt updates follow database persistence. After a reconnect or missed updates, OpenCode refreshes wallet state and receipt history. Amounts and generations use exact decimal strings; clients must preserve their integer precision.

The recovery view includes an additional 15-second margin after a booking’s expiry deadline. This is an indexer rule; the program uses the stored claim deadline. See settlement.

Operation and backups

Keep configuration, sessions, indexed wallet records, and backups private. Use a consistent SQLite backup, or stop the service before copying its database. Copying only the main file while writes continue can omit committed data in the write-ahead log.

Stop the service with SIGINT or SIGTERM. After restoring a backup, the indexer reconciles current public state. An older backup can lose session changes and receipt coverage; reconciliation cannot recover transactions that are no longer available from its sources.

Self-hosting controls this service’s availability and stored data. Payments remain public, and the selected provider still receives inference content.