Quickstart
Create a key and send a first request in a few minutes.
Create a key
Open API keys and select Create key. Name it after what will use it, and copy the key when it appears: it is shown once.
New accounts get up to $2.50 of free credit for open-weight text models, like the one below. For any other model, add credit with USDC or INFERENCE.
Set the key
export DEFERENCE_API_KEY="sk-df-..."$env:DEFERENCE_API_KEY = "sk-df-..."Send a request
curl https://deference.si/v1/chat/completions \
-H "Authorization: Bearer $DEFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-v3.2",
"messages": [{ "role": "user", "content": "Say hello in one sentence." }],
"max_tokens": 100
}'import os
from openai import OpenAI
client = OpenAI(
base_url="https://deference.si/v1",
api_key=os.environ["DEFERENCE_API_KEY"],
)
response = client.chat.completions.create(
model="deepseek/deepseek-v3.2",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
max_tokens=100,
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://deference.si/v1",
apiKey: process.env.DEFERENCE_API_KEY,
});
const response = await client.chat.completions.create({
model: "deepseek/deepseek-v3.2",
messages: [{ role: "user", content: "Say hello in one sentence." }],
max_tokens: 100,
});
console.log(response.choices[0].message.content);Swap model for any id from Models. Requests that do not meet the free-credit rules need credit.
Check it in Activity
Open Activity. The request is the top row, with its model, tokens and cost. Until the charge settles, the cost is marked as an estimate, then shows the final amount.
Deference rejects invalid keys, missing models, insufficient credit, and its own rate limits before opening an Activity row. Provider errors such as 404 and 429 do appear. A provider 429 counts as a failure.
If it fails
| You see | Cause | Fix |
|---|---|---|
401 missing_api_key | The variable is empty, so no key was sent | Set the variable in the shell that runs the code |
401 invalid_api_key | The key is mistyped | Set the variable again from your saved key, or create a replacement. Keep the value out of logs |
402 insufficient_credit | The account has no available credit | Add credit |
402 free_ | The account has only free credit, and this model or request does not qualify | Check the model price and request restrictions. Lower max_tokens if the worst-case estimate exceeds $0.05, or add credit |
404 model_not_found | The model id is not in the catalog | Copy an id from the Models page |
429 rate_limited | Too many requests in a minute | Wait for the retry-after seconds |
Set up a tool
Point your coding tool at Deference next. Every guide is in Coding tools.
Writing code instead? See what your key can do.