Skip to main content

Argus observability SDK for Python — tracks per-call cost and latency for Anthropic and OpenAI

Project description

buildit-argus

Track per-call LLM cost and latency for Python apps — powered by the Argus observability dashboard.

Zero dependencies. Works with Anthropic, OpenAI, or any provider via manual tracking.


Installation

pip install buildit-argus

Quick start

import argus

argus.init(
    endpoint='https://api.buildit.sh',
    api_key='bld_live_...',  # Settings → API Keys on app.buildit.sh
)

Usage

Anthropic

Wrap your Anthropic client once — every messages.create call is tracked automatically.

import anthropic
import argus

argus.init(endpoint='https://api.buildit.sh', api_key='bld_live_...')

client = argus.wrap_anthropic(anthropic.Anthropic())

msg = client.messages.create(
    model='claude-haiku-4-5-20251001',
    max_tokens=1024,
    messages=[{'role': 'user', 'content': 'Hello'}],
)

OpenAI

from openai import OpenAI
import argus

argus.init(endpoint='https://api.buildit.sh', api_key='bld_live_...')

client = argus.wrap_openai(OpenAI())

res = client.chat.completions.create(
    model='gpt-4o-mini',
    messages=[{'role': 'user', 'content': 'Hello'}],
)

Manual tracking

result = argus.track(
    provider='my-provider',
    model='my-model-v1',
    fn=lambda: my_llm_call(),
    op_name='chat',  # optional label shown in dashboard
)

API

argus.init(endpoint, api_key)

Param Default Description
endpoint ARGUS_ENDPOINT env var Your Argus ingest URL
api_key ARGUS_KEY env var API key from buildit.sh

argus.wrap_anthropic(client)

Patches client.messages.create to auto-track every call. Returns the same client.

argus.wrap_openai(client)

Patches client.chat.completions.create to auto-track every call. Returns the same client.

argus.track(provider, model, fn, op_name, options)

Param Type Description
provider str Provider name (e.g. anthropic, openai)
model str Model ID
fn callable The call to wrap
op_name str Optional label shown in dashboard
options list Optional feature flags

Environment variables

export ARGUS_ENDPOINT=https://api.buildit.sh
export ARGUS_KEY=bld_live_...

If set, you don't need to call argus.init().


Get an API key

  1. Sign in at app.buildit.sh
  2. Go to Settings → API Keys
  3. Click Create key
  4. Pass it to argus.init() or set ARGUS_KEY in your environment

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

buildit_argus-0.1.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

buildit_argus-0.1.2-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file buildit_argus-0.1.2.tar.gz.

File metadata

  • Download URL: buildit_argus-0.1.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for buildit_argus-0.1.2.tar.gz
Algorithm Hash digest
SHA256 884338e1078cf26d5a7187a4c988a5b1c0938f4bad3b03f83d9dc8b064449223
MD5 f904ec73f8ee3f43241712d5958a55f1
BLAKE2b-256 3d9755c4619b642531f429a494d66b49236c74e6c02d62f709d508d1504bfe79

See more details on using hashes here.

File details

Details for the file buildit_argus-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: buildit_argus-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for buildit_argus-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f6bfb00820b12540b2f5a6d235d404405be40decfa703a597a07419e11390a6a
MD5 9cc3897949fef6b738309f8d94b9c48b
BLAKE2b-256 bb15117bfbf43dc5c0f5053541982c8928b991217e6e5fc6beda6ad84b09b4a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page