Skip to main content
Task are automatically created when you send requests with a x-inference-task-id header. The task appears in the dashboard as soon as the first tagged request comes through.

Set the task header

Add x-inference-task-id to your request. The value is whatever name makes sense for the objective — document-summary, ticket-classifier, extract-product-data, etc. You can set the task per request, or put it in defaultHeaders on the client if all calls from that client belong to the same task. Per request (use when one client serves multiple tasks):
const response = await client.chat.completions.create({
  model: "gpt-4.1",
  messages: [{ role: "user", content: "Summarize this document..." }],
}, {
  headers: { "x-inference-task-id": "document-summary" },
});
In default headers (use when a client is dedicated to one task):
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.inference.net/v1",
  apiKey: process.env.INFERENCE_API_KEY,
  defaultHeaders: {
    "x-inference-provider-api-key": process.env.OPENAI_API_KEY,
    "x-inference-provider": "openai",
    "x-inference-task-id": "document-summary",
    "x-inference-environment": "production",
  },
});

The default task

If you don’t set x-inference-task-id, the request is grouped under the default task. Your traffic is still captured, but it’s all in one bucket. Once you start tagging, you can break down metrics, run evals, and build datasets per task.

Assign task IDs automatically

Use Install with AI if you want the CLI to add task IDs for you. It runs inf instrument, scans your codebase, and names each call site based on what the prompt is doing — for example, document-summary or ticket-classification. These are starting points; you can rename them by editing the x-inference-task-id header value in the generated code.