Guide2 min read

Make your first Fast Inference API request

Create a project key, call an OpenAI-compatible model, and verify the request in your usage dashboard.

Fast Inference

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.

Create and store a project key

  1. 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.

  2. Copy the key once

    The dashboard reveals the plaintext key once. Store it in a password manager or secret store before closing the dialog.

  3. Export it in your shell

    bash
    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
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

SymptomWhat to check
401 UnauthorizedConfirm the header uses Bearer followed by the complete key.
403 ForbiddenCreate a fresh key in Fast Web so it is scoped to your first project.
Model not foundCopy a currently callable model ID from the model catalog.
No usage appearsWait 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.

npm install openaibaseURL: "https://api.inference.net/v1"ship it