Get started
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. Models that are not open-weight need credit.
Check it in Activity
Open Activity. The request is the top row, with its model, tokens and cost. The cost reads "estimating" for a few seconds, then shows the final amount. A request rejected with a 401, 402, 404 or 429 does not appear there.
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_credit_not_eligible | The account has only free credit, and this model or request does not qualify | Use an open-weight text model, or set a lower max_tokens |
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.