Skip to content
Developer Documentation

API Reference

OpenAI-compatible inference powered by a decentralized swarm of consumer devices. Drop-in replacement for any OpenAI SDK with provenance metadata on every response.

Base URL: we1web-api.fly.dev/api/v1

Quick Start

Send your first request in under a minute. The W1W API is fully compatible with the OpenAI chat completions format.

bash
curl https://we1web-api.fly.dev/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "w1w-swarm",
    "messages": [{"role": "user", "content": "Hello"}],
    "stream": false
  }'

Response

json
{
  "id": "chatcmpl-w1w-abc123",
  "object": "chat.completion",
  "model": "w1w-swarm",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "_w1w": {
    "source": "swarm",
    "fallbackUsed": false,
    "durationMs": 342,
    "verificationStatus": "unverified",
    "nodesUsed": ["node-abc123"]
  }
}

The _w1w field is unique to W1W. It tells you exactly where your inference ran, whether the swarm or the Gemini fallback handled it, and how long it took.

Authentication

Authenticate requests with an API key from your dashboard. Free tier requests work without authentication but are rate-limited.

Bearer Token (recommended)

http
Authorization: Bearer w1w_sk_your_api_key_here

Query Parameter (convenience)

http
GET /api/v1/chat/completions?api_key=w1w_sk_your_api_key_here

Not recommended for production. API keys in URLs can be logged by proxies and CDNs.

OpenAI SDK Compatibility

W1W is a drop-in replacement for the OpenAI API. Point any OpenAI SDK at our base URL and everything works — same request format, same response structure, plus the extra _w1w provenance field.

python
from openai import OpenAI

client = OpenAI(
    base_url="https://we1web-api.fly.dev/api/v1",
    api_key="YOUR_W1W_API_KEY"
)

# Works exactly like OpenAI
response = client.chat.completions.create(
    model="w1w-swarm",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing in simple terms"}
    ],
    temperature=0.7,
    max_tokens=1024
)

print(response.choices[0].message.content)

# Access W1W provenance via the raw response
raw = response.model_extra  # or response._raw_response
print(f"Source: {raw.get('_w1w', {}).get('source')}")

Streaming

Set stream: true to receive Server-Sent Events (SSE). Each chunk contains a delta of the response as it is generated.

bash
curl https://we1web-api.fly.dev/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "w1w-swarm",
    "messages": [{"role": "user", "content": "Write a haiku"}],
    "stream": true
  }'

SSE Chunk Format

sse
data: {"id":"chatcmpl-w1w-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}

data: {"id":"chatcmpl-w1w-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}

data: {"id":"chatcmpl-w1w-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"_w1w":{"source":"swarm","fallbackUsed":false,"durationMs":215,"verificationStatus":"unverified","nodesUsed":["node-abc123"]}}

data: [DONE]

Rate Limits & Tiers

There are no monthly plans. Limits unlock permanently from your cumulative prepaid credit spend, and never lapse or downgrade. Every tier includes full provenance metadata and swarm-first routing, and rate limit headers are included in every response.

TierPriceReq/minReq/dayMax TokensTokens/day
FreeDefault510051250K
StarterAfter $5 in credits3010,0002,048500K
ProPopularAfter $100 in credits120100,0004,0965M
EnterpriseContract600Unlimited8,192Unlimited

Rate Limit Headers

http
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 27
X-RateLimit-Reset: 1714531200
Retry-After: 60

When rate limited, the API returns HTTP 429 with a Retry-After header indicating how many seconds to wait.

Provenance Metadata

Every W1W response includes a _w1w object with provenance metadata: source, fallback status, latency, verification status, and the IDs of the nodes that served the request — plus a signed receipt where available. Verification is sampled server-side re-checking, not caller-side cryptographic proof, and we say so. That honesty is what makes W1W different from centralized APIs.

FieldTypeDescription
source"swarm" | "gemini"Whether the response was generated by a peer device in the swarm or by the Gemini fallback.
fallbackUsedbooleantrue if no swarm nodes were available and the request fell back to Gemini.
durationMsnumberEnd-to-end inference latency in milliseconds.
verificationStatus"verified" | "unverified" | "centralized" | "unavailable" | "blocked" | "error"Trust state of the result. Most swarm responses are "unverified" until a sampled re-check runs; "centralized" marks a hosted-fallback answer.
nodesUsedstring[]Peer IDs of the compute nodes that processed this request.

Swarm Response

When a peer device in the network handles your request directly:

json
"_w1w": {
  "source": "swarm",
  "fallbackUsed": false,
  "durationMs": 342,
  "verificationStatus": "unverified",
  "nodesUsed": ["node-abc123"]
}

Gemini Fallback

When no swarm nodes are available, the request falls back to Google Gemini:

json
"_w1w": {
  "source": "gemini",
  "fallbackUsed": true,
  "durationMs": 1205,
  "verificationStatus": "centralized",
  "nodesUsed": []
}

Playground

Try the API right here. Free tier works without an API key. Paste your key for higher limits.

API Playground

Send real requests to the W1W inference API

Live
Send a message to get started

Ready to build?

Get an API key from your dashboard and start integrating W1W inference into your application.