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.3.0.tar.gz (4.7 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.3.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: usageflow_fastapi-0.3.0.tar.gz
  • Upload date:
  • Size: 4.7 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.3.0.tar.gz
Algorithm Hash digest
SHA256 6ad9a83da8dff39e18b15baf5c5771f851396482a6a25520cf1b831adcf47361
MD5 0d82f78f1fa1f09e1b21c64f7e8e54c5
BLAKE2b-256 e13bc6a1dc3e9a8d781ca5a5ea292e83a170c478a00230faabf24c597c315842

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for usageflow_fastapi-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08a0c77d86fbcd1fb2779fc7eb449ae6452fdafb8857459c8729219ca30b73cf
MD5 31f00219478535aee02c7544756ed30c
BLAKE2b-256 f29528c54ffc73574573b2665348f0f520f264109b43d5c42f9a2b7161c75a03

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