Skip to main content

Drop-in API monitoring for Flask and FastAPI

Project description

pingoni

Drop-in API monitoring for Flask and FastAPI. One install, every request tracked.

Install

pip install pingoni

Flask

from flask import Flask
from pingoni import init_flask

app = Flask(__name__)
init_flask(app, api_key="your_pingoni_api_key")

@app.route("/")
def home():
    return {"status": "ok"}

FastAPI

from fastapi import FastAPI
from pingoni import init_fastapi

app = FastAPI()
init_fastapi(app, api_key="your_pingoni_api_key")

@app.get("/")
def home():
    return {"status": "ok"}

LLM cost tracking

Track every OpenAI / Anthropic call by cost, per-user, per-feature.

from openai import OpenAI
from pingoni import track_llm

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

track_llm(
    provider="openai",
    model="gpt-4o-mini",
    usage=response.usage.model_dump(),
    user_id="user_123",
    feature="chat",
    api_key="your_pingoni_api_key",
)

Get an API key

Sign up at pingoni.com.

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

pingoni-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

pingoni-0.1.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pingoni-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4e00ae4ca09d68b606c043d2379969330ec4e00b14f68bcb9235706ccae697fe
MD5 f194cf595b98d09a1a23534117e9eea3
BLAKE2b-256 77a0977952a5e72ed7671ef4e8e02f5f441743f38545ef84f5f901a07d513c05

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pingoni-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c3d9a965fe6a26bfe74e6e7c4d3ff68461cd1ef765f780b9be4910105e777033
MD5 384b4752c3e5374177dd41adb5109bdb
BLAKE2b-256 d1787f2cabdf36085aaf1d0e66a68ef834d0fdd71900843122acdc8c99ee1643

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