Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
pip install traceAI-anthropic anthropic
npm install @traceai/anthropic @anthropic-ai/sdk
import os
os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY
os.environ["ANTHROPIC_API_KEY"] = ANTHROPIC_API_KEY
process.env.FI_API_KEY = FI_API_KEY;
process.env.FI_SECRET_KEY = FI_SECRET_KEY;
process.env.ANTHROPIC_API_KEY = ANTHROPIC_API_KEY;
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="anthropic_project",
)
import { register, ProjectType } from "@traceai/fi-core";
const traceProvider = register({
project_type: ProjectType.OBSERVE,
project_name: "anthropic_project",
});
from traceai_anthropic import AnthropicInstrumentor
AnthropicInstrumentor().instrument(tracer_provider=trace_provider)
import { AnthropicInstrumentation } from "@traceai/anthropic";
import { registerInstrumentations } from "@opentelemetry/instrumentation";
const anthropicInstrumentation = new AnthropicInstrumentation({});
registerInstrumentations({
instrumentations: [anthropicInstrumentation],
tracerProvider: tracerProvider,
});
import anthropic
import httpx
import base64
image_url = "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg"
image_media_type = "image/jpeg"
image_data = base64.standard_b64encode(httpx.get(image_url).content).decode("utf-8")
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-3-7-sonnet-20250219",
messages=[
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": image_media_type,
"data": image_data,
},
},
{
"type": "text",
"text": "Describe this image."
}
],
}
],
)
print(message)
import { Anthropic } from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});
const message = await client.messages.create({
model: "claude-3-7-sonnet-20250219",
max_tokens: 50,
messages: [{ role: "user", content: "Hello Claude! Write a short haiku." }],
});
Was this page helpful?