Skip to contentNewDeepSeek V4.1 Flash 1017 is now availableTry it now
Docs / Tasks

Tasks

Group requests by what they do, such as summarizing a document or classifying a ticket, and see usage for each task.

A task is one job your application asks a model to do, such as "summarize this document", "classify this ticket", or "extract these fields". You give each task a name, and Inference.net groups every request with that name together.

Tasks group requests by purpose, not by model or prompt. You can change the model or rewrite the prompt for a task, and its history stays in one place.

Why use tasks

When your application has more than one AI feature, tasks let you:

  • See requests, cost, and success rate for each feature separately.
  • Compare the models each feature uses.
  • Change the model or prompt for one feature without mixing its numbers with the others.

Create a task

You create a task by sending a request with the x-inference-task-id header. You do not need to set it up first. The task appears in the dashboard when the first request with that header arrives.

Use a short, descriptive name in lowercase with hyphens, such as document-summary, ticket-classifier, or extract-product-data. Every request that uses the same name belongs to the same task.

Set the task on each request

Use this when one client sends requests for more than one task.

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: "Summarize this document..." }],
  },
  {
    headers: { "x-inference-task-id": "document-summary" },
  },
);

Set the task for a whole client

Use this when a client only sends requests for one task. Put the header in the client's default headers, and every request from that client belongs to the task.

import OpenAI from "openai";

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

The default task

Requests without an x-inference-task-id header go into the default task. A header set to default does the same. These requests are still recorded, but they all share one group. Add task names to see each feature on its own.

See your tasks

Open Usage in the dashboard and select Tasks. Each task shows its requests, cost, success rate, and the models it used for the selected time range.

Select a task to see its usage over time. To hide a task you no longer use, archive it from the task list. You can unarchive it later.