Skip to main content

FastAPI middleware for UsageFlow - Usage-based pricing made simple

Project description

UsageFlow FastAPI

FastAPI middleware for UsageFlow - Usage-based pricing made simple.

Installation

pip install usageflow-fastapi

Usage

from fastapi import FastAPI
from usageflow.fastapi import UsageFlowMiddleware

app = FastAPI()

# Initialize UsageFlow middleware
app.add_middleware(UsageFlowMiddleware, api_key="your-api-key")

@app.get("/")
async def home():
    return {"message": "Hello World!"}

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

Features

  • Automatic usage tracking
  • Request/response logging
  • Rate limiting
  • User identification
  • Custom metadata support
  • Async support

Documentation

For full documentation, visit https://docs.usageflow.io

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

usageflow_fastapi-0.1.0.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.

usageflow_fastapi-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file usageflow_fastapi-0.1.0.tar.gz.

File metadata

  • Download URL: usageflow_fastapi-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for usageflow_fastapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d10573d07621cfb1eb3038736a78384c1d06ca4eecd3ab565f0c679f5f890a44
MD5 c830f4407b8c874623043e9b823e42c0
BLAKE2b-256 fad11cc25188b294c3b6e06d7432e4e8b1daed5ae3e7f515357cc5adab7584c2

See more details on using hashes here.

File details

Details for the file usageflow_fastapi-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for usageflow_fastapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3603058c87db40e42fa9a1d69b34d22379d96ab818d3369a87348a2d77b93c47
MD5 6dc1a26d61cd50d426c7398dcfe7c23c
BLAKE2b-256 59ad35837677acef05dcabee5cf38f2c8fcd1116b1c41e57de52a9d34a782724

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