Fast Inference exposes fast hosted models through one OpenAI-compatible API. This guide takes you from a new account to a verified request without adding a provider-specific SDK or managing a model deployment.
You need a Fast Inference account and a shell that can set an environment variable. New accounts receive one project automatically; the key, request, and usage data in this guide all stay scoped to that project.
Create and store a project key
Open the API key dashboard
Create an account or sign in, then open API Keys. Choose Create API key and give the key a name you will recognize later.
Copy the key once
The dashboard reveals the plaintext key once. Store it in a password manager or secret store before closing the dialog.
Keep it out of source controlTreat the value like a password. Fast Inference stores only a secure representation and cannot reveal the original value later.
Export it in your shell
export INFERENCE_API_KEY="inf_sk_..."
Send a chat completion
Every request uses the same base URL and a model ID from the live model catalog. Start with curl to verify the key independently of your application.
curl https://api.inference.net/v1/chat/completions \
-H "Authorization: Bearer $INFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.2",
"messages": [
{ "role": "user", "content": "Explain speculative decoding in one sentence." }
]
}'A successful response contains the assistant message at
choices[0].message.content and token counts under usage.
Use an OpenAI-compatible SDK
Point an existing OpenAI client at the Fast Inference base URL. The rest of your application can keep the familiar chat-completions interface.
import OpenAI from "openai"
const client = new OpenAI({
baseURL: "https://api.inference.net/v1",
apiKey: process.env.INFERENCE_API_KEY,
})
const response = await client.chat.completions.create({
model: "glm-5.2",
messages: [
{ role: "user", content: "Write one fast sentence." },
],
})
console.log(response.choices[0].message.content)
Verify usage and cost
Open Usage after the request completes. The request will appear in the spend graph and model table after ingestion. Hover the relevant bar to inspect spend and input/output tokens for the model.
This closes the loop: the key you created, the model request, and the dashboard analytics all belong to the same automatically selected project.
Troubleshooting
| Symptom | What to check |
|---|---|
401 Unauthorized | Confirm the header uses Bearer followed by the complete key. |
403 Forbidden | Create a fresh key in Fast Web so it is scoped to your first project. |
| Model not found | Copy a currently callable model ID from the model catalog. |
| No usage appears | Wait briefly for ingestion, then confirm the request and dashboard use the same account. |
Next, connect a coding agent with the fast CLI, or compare
available models in the catalog.