Track ClaudeClaudeAnthropic’s family of AI models. TelemHQ can track Claude jobs by recording model names, token usage, latency, cost, and run metadata.View glossary entrySource: Anthropic model docs Jobs
Send a TelemHQ pingpingA request sent to TelemHQ after a job runs. A ping can be a simple heartbeat or include JSON payload data about what happened.View glossary entrySource: TelemHQ docs after each Claude run with modelmodelThe AI system that processes input and returns output. For monitoring, the model name helps explain which tool or provider produced a run and how its token usage should be priced.View glossary entrySource: Anthropic model docs, token usagetokensThe pieces of text an AI model processes. Token counts are often used to measure usage and calculate model cost.View glossary entrySource: OpenAI token guide, latencylatencyHow long a request or job takes to respond. AI job latency helps teams spot slow model calls, overloaded workers, or expensive retries.View glossary entrySource: MDN glossary, item counts, costcostThe money associated with a run, often estimated from token usage and provider pricing. TelemHQ can store cost fields when your job sends them.View glossary entrySource: OpenAI token guide, and pipelinepipelineA sequence of automated steps that moves data or work from one stage to another. AI pipelines often include retrieval, model calls, post-processing, and reporting.View glossary entrySource: GitHub Actions CI docs quality signals.
Using Claude CodeClaude CodeA Claude-based coding tool. In TelemHQ, its usage can be tracked like other coding assistants when a run sends structured metadata after work completes.View glossary entrySource: Anthropic model docs instead of the AnthropicAnthropicThe company behind Claude, a family of AI models used for chat, coding, analysis, and tool-using workflows.View glossary entrySource: Anthropic model docs APIAPIA software interface that lets programs interact through defined rules, URLs, methods, and data formats.View glossary entrySource: MDN API glossary? Follow the separate Claude Code hooks guide.
Recommended PayloadpayloadThe structured data sent with a request. In TelemHQ, payloads should contain safe operational metadata, not prompts, completions, secrets, customer data, or private paths.View glossary entrySource: MDN API glossary
Anthropic Messages responses include usage with input and output token counts. TelemHQ stores those alongside the operational facts your AIAISoftware that performs tasks normally associated with human judgment, language understanding, or pattern matching. In TelemHQ, AI usually means jobs that call a model, agent, or coding tool.View glossary entrySource: Google Cloud Generative AI glossary job cares about.
{
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"status": "success",
"input_tokens": 6200,
"output_tokens": 710,
"total_tokens": 6910,
"latency_ms": 2140,
"cost_usd": 0.38,
"items_processed": 84,
"items_failed": 0,
"eval_score": 0.89
}
Avoid sending prompts, outputs, customer data, or retrieved documents unless you intentionally want them stored in TelemHQ.
Node.js
Install the Anthropic SDKSDKA software development kit is a package of tools or libraries for building with a platform or API.View glossary entrySource: MDN API glossary and set TELEMHQ_PING_URL to your trackertrackerA monitored job, AI pipeline, worker, script, or automation in TelemHQ. Each tracker has its own ping URL and run history.View glossary entrySource: TelemHQ docs
URL.
npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
const model = process.env.CLAUDE_MODEL || "claude-sonnet-4-20250514";
const startedAt = Date.now();
try {
const message = await anthropic.messages.create({
model,
max_tokens: 1024,
messages: [{ role: "user", content: "Summarize today's support tickets." }]
});
const usage = message.usage || {};
const inputTokens = usage.input_tokens || 0;
const outputTokens = usage.output_tokens || 0;
await fetch(process.env.TELEMHQ_PING_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
provider: "anthropic",
model: message.model || model,
status: "success",
input_tokens: inputTokens,
output_tokens: outputTokens,
total_tokens: inputTokens + outputTokens,
latency_ms: Date.now() - startedAt,
items_processed: 1,
items_failed: 0,
eval_score: 0.89
})
});
} catch (error) {
await fetch(process.env.TELEMHQ_PING_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
provider: "anthropic",
model,
status: "error",
latency_ms: Date.now() - startedAt,
items_processed: 0,
items_failed: 1,
error: error instanceof Error ? error.message : "Unknown error"
})
});
throw error;
}
Python
This works for scheduled scripts, workersworkerA background process that performs work outside the main request path, such as syncing data, generating reports, or running AI tasks.View glossary entrySource: GitHub Actions CI docs, and batchbatchA group of records or tasks processed together. Batch jobs are often monitored by counting processed items, failed items, duration, and cost.View glossary entrySource: Anthropic API overview processors.
pip install anthropic requests
import os
import time
import requests
import anthropic
client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
model = os.getenv("CLAUDE_MODEL", "claude-sonnet-4-20250514")
started_at = time.time()
try:
message = client.messages.create(
model=model,
max_tokens=1024,
messages=[{"role": "user", "content": "Summarize today's support tickets."}],
)
usage = message.usage
input_tokens = getattr(usage, "input_tokens", 0)
output_tokens = getattr(usage, "output_tokens", 0)
requests.post(
os.environ["TELEMHQ_PING_URL"],
json={
"provider": "anthropic",
"model": getattr(message, "model", model),
"status": "success",
"input_tokens": input_tokens,
"output_tokens": output_tokens,
"total_tokens": input_tokens + output_tokens,
"latency_ms": round((time.time() - started_at) * 1000),
"items_processed": 1,
"items_failed": 0,
"eval_score": 0.89,
},
timeout=10,
)
except Exception as exc:
requests.post(
os.environ["TELEMHQ_PING_URL"],
json={
"provider": "anthropic",
"model": model,
"status": "error",
"latency_ms": round((time.time() - started_at) * 1000),
"items_processed": 0,
"items_failed": 1,
"error": str(exc),
},
timeout=10,
)
raise
Batch Jobs
For Message Batches, ping TelemHQ after you collect the batch results. Use payload fields such as
batch_id, items_processed,
items_failed, and duration_ms.
{
"provider": "anthropic",
"job_type": "message_batch",
"batch_id": "msgbatch_...",
"status": "success",
"items_processed": 5000,
"items_failed": 0,
"duration_ms": 480000
}
Suggested AssertionsassertionA rule that checks payload data after a run. Assertions can flag a job as unhealthy even if the process technically completed.View glossary entrySource: TelemHQ docs
Add these checks on the tracker detail page to catch pipeline runs that technically completed but produced bad output.
status = successitems_processed > 0items_failed = 0cost_usd <= your budgeteval_score >= your quality threshold
Official reference: Anthropic Messages examples.