@mlflow/anthropic
v0.2.0
Published
Anthropic integration package for MLflow Tracing
Maintainers
Readme
MLflow Typescript SDK - Anthropic
Seamlessly integrate MLflow Tracing with Anthropic to automatically trace your Claude API calls.
| Package | NPM | Description |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| @mlflow/anthropic | | Auto-instrumentation integration for Anthropic. |
Installation
npm install @mlflow/anthropicThe package includes the @mlflow/core package and @anthropic-ai/sdk package as peer dependencies. Depending on your package manager, you may need to install these two packages separately.
Quickstart
Start MLflow Tracking Server if you don't have one already:
pip install mlflow
mlflow server --backend-store-uri sqlite:///mlruns.db --port 5000Self-hosting MLflow server requires Python 3.10 or higher. If you don't have one, you can also use managed MLflow service for free to get started quickly.
Instantiate MLflow SDK in your application:
import * as mlflow from '@mlflow/core';
mlflow.init({
trackingUri: 'http://localhost:5000',
experimentId: '<experiment-id>',
});Create a trace for Anthropic Claude:
import Anthropic from '@anthropic-ai/sdk';
import { tracedAnthropic } from '@mlflow/anthropic';
const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
const client = tracedAnthropic(anthropic);
const response = await client.messages.create({
model: 'claude-3-7-sonnet-20250219',
max_tokens: 256,
messages: [{ role: 'user', content: 'Hello Claude' }],
});View traces in MLflow UI:

Documentation 📘
Official documentation for MLflow Typescript SDK can be found here.
License
This project is licensed under the Apache License 2.0.
