Quickstart
Spot implements the OpenAI Chat Completions API. If you already call a hosted model, you are two lines away from buying the same capability at the market price. This page takes about five minutes end to end.
Paths:
01 — Create a key
Keys live in the dashboard under Developers → API keys. A key is scoped to one environment and carries an optional account-wide price ceiling, which nothing can override at request time.
export SPOT_KEY="sk_live_9f2c…"02 — Point your client at Spot
Keep your SDK, your version, and your request shape. Only the base URL changes.
from openai import OpenAI
client = OpenAI(
base_url="https://api.spot.market/v1",
api_key=os.environ["SPOT_KEY"],
)
Discovery for a local or staging gateway:
- Pass an explicit
base_url/baseUrlto the client constructor, or - Call
from_config/fromConfigwith a config origin (GET {config_url}/config→gatewayApiUrl), or - Error — there is no hardcoded fallback URL.
Set GATEWAY_URL (explicit constructor) or GATEWAY_CONFIG_URL (discovery) in the environment.
03 — Set what you'll pay
max_price is a hard ceiling in dollars per million tokens, applied to the blended input and output rate. Omit it and the request fills at the prevailing mid.
resp = client.chat.completions.create(
model="gpt-class-mid",
max_price=0.28,
messages=[{"role":"user","content":"ping"}],
)
On the live gateway the field is a decimal string per 1,000 tokens — see Buyer flow and POST /v1/chat/completions.
04 — Read the fill
Every response carries a spot object: what you paid, what list would have been, and which venue class served you. Log it and you have a running record of your own effective rate.
print(resp.spot.fill_price) # 0.2410
print(resp.spot.vs_list) # -0.427
Tighten your ceiling with Price limits & routing, or see every field in the Chat completions reference.