Getting Started with Florentin
Get up and running with Florentin in under 5 minutes. This guide walks you through installation, authentication, and your first API call.
Installation
Install the Florentin SDK for your preferred language:
pip install florentinnpm install florentin #
or yarn add florentingo get github.com/florentin/florentin-goAuthentication
Create a client instance with your API key. You can find your key in the Dashboard → Settings → API Keys.
from florentin import Florentin client =
Florentin(api_key="sk_live_...")import { Florentin } from "florentin"; const
client = new Florentin({ apiKey: "sk_live_..." });import
"github.com/florentin/florentin-go" client := florentin.NewClient("sk_live_...")Your First API Call
Record usage for a customer:
# Record usage response = client.usage.record(
customer_id="cust_123", product_id="prod_api", quantity=1500, unit="tokens" ) print(f"Recorded:
{response.quantity} {response.unit}")// Record usage const response = await
client.usage.record({ customerId: "cust_123", productId: "prod_api", quantity: 1500, unit: "tokens"
}); console.log(`Recorded: ${response.quantity} ${response.unit}`);// Record usage
response, err := client.Usage.Record(ctx, &florentin.UsageParams{ CustomerID: "cust_123",
ProductID: "prod_api", Quantity: 1500, Unit: "tokens", }) fmt.Printf("Recorded: %d %s
",
response.Quantity, response.Unit)