Docs
Sign inJoin the waitlist

Move a call from the Anthropic SDK

A Model answers on the OpenAI chat API, so a call made with the Anthropic SDK moves to the OpenAI SDK. The system prompt goes away: Facet writes and keeps the Model’s Instructions.

Python

Before, with Claude:

import anthropic

client = anthropic.Anthropic()
msg = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=512,
    system="Label each ticket billing, bug or account...",
    messages=[{"role": "user", "content": ticket}],
)
label = msg.content[0].text

After, with a Facet Model:

import os
from openai import OpenAI

client = OpenAI(base_url=os.environ["FACET_BASE_URL"], api_key=os.environ["FACET_API_KEY"])
reply = client.chat.completions.create(
    model="support-triage",
    messages=[{"role": "user", "content": ticket}],
)
label = reply.choices[0].message.content

TypeScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: process.env.FACET_BASE_URL, apiKey: process.env.FACET_API_KEY });
const reply = await client.chat.completions.create({
  model: "support-triage",
  messages: [{ role: "user", content: ticket }],
});
const label = reply.choices[0].message.content;

What changes

Anthropic SDK Facet Model
system Left out; Facet sends the Model’s Instructions
msg.content[0].text reply.choices[0].message.content
max_tokens required Optional
stop_reason finish_reason

To make the Model from the call, paste the old system prompt and a few real inputs into your coding agent and ask it to use Facet, or open New model in the web app to connect one. See Use Facet from an agent.

Next steps

Esc