Agents: this page is also Markdown; every page is in llms.txt.

Call a Task

Tasks are served through an OpenAI-compatible API, so any OpenAI SDK or client works. Set the base URL to your serving URL (shown in each Task's Use it panel) and the model to the Task's name.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "<your serving URL>", apiKey: process.env.FACET_API_KEY });
const reply = await client.chat.completions.create({
  model: "support-triage",
  messages: [{ role: "user", content: "My card was charged twice" }],
});
curl <your serving URL>/chat/completions \
  -H "Authorization: Bearer $FACET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "support-triage", "messages": [{"role": "user", "content": "My card was charged twice"}]}'

Versions

The response's x-facet-version header names the Version that answered, and x-facet-request-id identifies the call.

Keys

API keys start with fct_. Make them under Workspace settings, Keys; a key can be limited to one Task, and a viewer key only reads. Keep keys in your app's secrets, never in code. Facet keeps only each call's metadata (Version, key, tokens, latency), never the messages or answers.

Instructions

Facet adds the Task's Instructions to every call, so send only the input. Don't add your own system prompt: Facet owns the Instructions and improves them with each Change.