// docs

API documentation

One OpenAI-compatible endpoint for the whole model catalogue. Non-custodial: connect a wallet, hold $MODEL, mint a key, call the gateway.

// overview

Overview

Model Network is a token-gated inference gateway. One base URL, one key, one OpenAI-compatible schema across every model in the catalogue. Your access level is derived from the $MODEL balance held by the wallet you connect — there is no subscription, invoice or card on file. We are non-custodial: you connect a wallet, sign a message to prove ownership, and keep your keys at all times.

Base URL   https://model-network.xyz/api/public/v1
Auth       Authorization: Bearer <your API key>
Schema     OpenAI Chat Completions (v1)
Settlement Solana mainnet-beta (SPL balance read, no transfer)

// quickstart

Quickstart in four steps

Connect a wallet, hold the qualifying balance, mint a key in the API Keys page, then call the gateway. Any OpenAI-compatible client works by pointing base_url at the gateway — no vendor-specific SDK is needed.

1. Connect wallet   -> Phantom / Solflare / Backpack, sign a nonce
2. Balance read     -> SPL mint on mainnet-beta resolves your tier
3. Mint API key     -> shown once, stored as a hash
4. Call the gateway -> POST https://model-network.xyz/api/public/v1/chat/completions

// auth

Authentication

Keys are shown once at creation and stored only as a hash — we cannot recover a lost key, only revoke it and issue a new one. Send it as a bearer token on every request. Keys inherit the entitlement of the wallet that minted them: if the balance drops below the qualifying threshold, calls return 403 until it recovers. Never ship a key in browser code; proxy through your own backend.

Authorization: Bearer ak_live_xxxxxxxxxxxxxxxxxxxx

# CORS preflight is answered on every endpoint:
OPTIONS https://model-network.xyz/api/public/v1/chat/completions -> 204
access-control-allow-headers: authorization, content-type, x-api-key
access-control-allow-methods: GET, POST, OPTIONS

// sdks

Using existing SDKs

Because the schema matches v1, the official OpenAI SDKs work unchanged — only the base URL and key differ. The same applies to LangChain, LlamaIndex, the Vercel AI SDK and anything else that accepts an OpenAI-compatible endpoint.

# Python
from openai import OpenAI
client = OpenAI(api_key=API_KEY, base_url="https://model-network.xyz/api/public/v1")
resp = client.chat.completions.create(
    model="anthropic/claude-3.5-sonnet",
    messages=[{"role": "user", "content": "Summarise this changelog."}],
    stream=True,
)
for chunk in resp:
    print(chunk.choices[0].delta.content or "", end="")

// TypeScript
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.API_KEY, baseURL: "https://model-network.xyz/api/public/v1" });
const r = await client.chat.completions.create({
  model: "openai/gpt-4o-mini",
  messages: [{ role: "user", content: "ping" }],
});

// playground

Playground and Activity

The Playground issues the exact same authenticated calls your code will make, against the same metering path, so a prompt that works there works verbatim over HTTP. The Activity page logs every request with model, provider route, input and output tokens, latency, cost and status — filter by key to attribute spend across environments.