
Security News
Re-Enabled GitHub Actions Expose Thousands of Repositories to Mini Shai-Hulud
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.
@haiec/anthropic
Advanced tools
Anthropic Claude SDK wrapper with automatic usage tracking and cost calculation for HAIEC AI Inventory
Anthropic Claude SDK wrapper with automatic usage tracking and cost calculation for HAIEC AI Inventory.
npm install @haiec/anthropic @anthropic-ai/sdk
import TrackedAnthropic from '@haiec/anthropic';
const client = new TrackedAnthropic({
apiKey: process.env.ANTHROPIC_API_KEY!,
haiecApiKey: process.env.HAIEC_API_KEY!,
});
const response = await client.messages.create({
model: 'claude-3-opus-20240229',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude!' }],
});
console.log(response.content[0].text);
const stream = await client.messages.stream({
model: 'claude-3-sonnet-20240229',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Tell me a story' }],
});
for await (const event of stream) {
if (event.type === 'content_block_delta') {
process.stdout.write(event.delta.text);
}
}
const finalMessage = await stream.finalMessage();
// Usage is automatically logged when stream completes
const client = new TrackedAnthropic({
apiKey: 'sk-ant-...', // Your Anthropic API key
haiecApiKey: 'haiec_...', // Your HAIEC API key
haiecEndpoint: 'https://haiec.com/api/v1/inventory/usage/log', // Optional: Custom endpoint
});
const client = new TrackedAnthropic({
apiKey: process.env.ANTHROPIC_API_KEY!,
haiecApiKey: process.env.HAIEC_API_KEY!,
haiecEndpoint: 'https://your-haiec-instance.com/api/v1/inventory/usage/log',
});
| Model | Input Cost (per 1M tokens) | Output Cost (per 1M tokens) |
|---|---|---|
| claude-3-opus-20240229 | $15.00 | $75.00 |
| claude-3-sonnet-20240229 | $3.00 | $15.00 |
| claude-3-haiku-20240307 | $0.25 | $1.25 |
| claude-2.1 | $8.00 | $24.00 |
| claude-2.0 | $8.00 | $24.00 |
| claude-instant-1.2 | $0.80 | $2.40 |
Pricing is automatically updated based on Anthropic's latest rates.
For each API call, the following data is logged to HAIEC:
anthropicclaude-3-opus-20240229messages or messages.streamIf usage tracking fails, the error is logged to console but your Anthropic API call continues normally:
try {
const response = await client.messages.create({...});
// Your response is returned even if tracking fails
} catch (error) {
// Only Anthropic API errors are thrown
}
This wrapper maintains 100% compatibility with the official Anthropic SDK. All methods and parameters work exactly the same.
Both regular and streaming responses are fully supported:
// Regular response
const response = await client.messages.create({...});
// Streaming response
const stream = await client.messages.stream({...});
for await (const event of stream) {
// Process events
}
Usage is automatically tracked for both modes.
| Feature | @haiec/openai | @haiec/anthropic |
|---|---|---|
| Provider | OpenAI | Anthropic |
| Streaming | ✅ | ✅ |
| Cost Tracking | ✅ | ✅ |
| Error Handling | ✅ | ✅ |
| Overhead | <10ms | <10ms |
MIT
FAQs
Anthropic Claude SDK wrapper with automatic usage tracking and cost calculation for HAIEC AI Inventory
We found that @haiec/anthropic demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.

Research
/Security News
The compromise affects MemTensor's MemOS, an open source memory framework for large language models (LLMs) and AI agents. Both npm package @memtensor/memos-cloud-openclaw-plugin and the PyPI package MemoryOS are compromised. They drop cross-platform Go binaries that exfiltrate developer secrets.