Developers

OpenAI-Compatible, Open Models

If your code talks to the OpenAI API, it already talks to sparehash. Change the base URL, pick a model, keep everything else.

Quickstart

Your First Request

Base URL: https://your-coordinator.fly.dev/v1

curl
curl https://your-coordinator.fly.dev/v1/chat/completions \
  -H "Authorization: Bearer $SPAREHASH_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen3-8b", "messages": [{"role": "user", "content": "Hello!"}]}'
Node.js · streaming
import OpenAI from 'openai';

const client = new OpenAI({ apiKey: process.env.SPAREHASH_KEY, baseURL: 'https://your-coordinator.fly.dev/v1' });
const stream = await client.chat.completions.create({
  model: 'llama-3.1-8b-instruct',
  stream: true,
  messages: [{ role: 'user', content: 'Write a haiku about idle GPUs.' }],
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
Python · embeddings
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["SPAREHASH_KEY"], base_url="https://your-coordinator.fly.dev/v1")
vectors = client.embeddings.create(model="nomic-embed-text", input=["hello", "world"])
Privacy

Private By Default

Before a request leaves sparehash, the privacy filter swaps credentials and personal data for placeholders. The machine that runs the model only ever sees [EMAIL_1] or [SECRET_1]; the real values are put back into the answer before it reaches you.

What's masked

  • API keys and tokens: OpenAI, Anthropic, Google, AWS, GitHub, Stripe, Slack, Hugging Face, JWTs, private keys
  • Passwords and secrets written as key=value, and passwords inside connection strings
  • Email addresses, phone numbers, card numbers, US SSNs and IBANs

And around it

  • The sparehash app runs models in a sandbox and never writes prompts to disk or logs
  • Hidden test requests check every node around the clock; nodes that fail are quarantined, then banned
  • Add X-Trusted-Only: 1 to use only verified, long-standing nodes

Know the limits

  • Names, street addresses and secrets written in plain words ("my PIN is the year I was born") can't be recognised, so they aren't masked
  • The model has to read your text to answer it. Someone who takes their own computer apart could still read the parts that aren't masked
  • For health, legal or financial records, call the provider directly from your own account rather than through a shared network
Choose per request: standard (default), secrets, off
curl https://your-coordinator.fly.dev/v1/chat/completions \
  -H "Authorization: Bearer $SPAREHASH_KEY" \
  -H "X-Privacy-Filter: secrets" \
  -H "X-Trusted-Only: 1" \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen3-32b", "messages": [{"role": "user", "content": "Draft a reply to [email protected]"}]}'
# x-sparehash-masked: number of values that were swapped out
Provider models

GPT, Claude and Gemini, Discounted

Sellers with spare capacity on official provider accounts list it on sparehash at a discount off the provider's list price. Call those models through the same key: put the provider in front of the model name. Requests go from sparehash straight to the provider's official API.

Official providers only

ProviderModel name
OpenAIopenai/gpt-6.1-sol
Anthropicanthropic/claude-sonnet-5.5
Google Geminigoogle/gemini-3.8-flash
Mistral AImistral/mistral-small-2603
xAIxai/grok-4.7
DeepSeekdeepseek/deepseek-v4.1-flash
Alibaba Cloud (Qwen)alibaba/qwen3.8-flash

How it works

  • Your request goes to the deepest discount that's live and healthy, and to the next seller if one fails before answering
  • You pay the provider's list price minus the seller's discount, from your USDC credits
  • Sellers never see requests, and the privacy filter applies here too
  • Tools, images and the provider's other features pass through untouched
  • What's on sale right now: GET /v1/models or the markets page
Node.js · same client as above
const reply = await client.chat.completions.create({
  model: 'anthropic/claude-sonnet-5.5',
  messages: [{ role: 'user', content: 'Summarise this contract in three bullet points.' }],
});
// x-sparehash-route: market · x-sparehash-discount-bps: 7500
Compatibility

What Works Today

Supported

  • POST /v1/chat/completions with stream and stream_options.include_usage
  • POST /v1/embeddings, float or base64
  • GET /v1/models, with pricing and license per model
  • max_tokens, temperature, top_p, stop, seed, response_format: json_object
  • On provider models (anthropic/…, openai/…): everything that provider supports

Not yet on sparehash nodes

  • Tool / function calling (returns a clear 400)
  • Image inputs, and n greater than 1
  • Fine-tuning, files, assistants and batch APIs
Errors

Status Codes

StatusCodeMeaning
400invalid_privacy_filterX-Privacy-Filter isn't standard, secrets or off
401invalid_api_keyMissing, wrong or revoked key
402insufficient_quotaNot enough credits for this request's worst case
404model_not_foundUnknown model id, or no seller lists that provider model
429rate_limit_exceededRequests or tokens per minute; honour retry-after
502upstream_failedEvery node failed; you were not charged
503no_capacityNo node or seller is serving that model right now

Request errors from a provider (e.g. an unsupported parameter) are passed through as the provider sent them.

Get Your Key

Sign in with your wallet, add USDC credits and create an API key.