Erste Schritte mit Florentin
Starte mit Florentin in unter 5 Minuten. Diese Anleitung zeigt dir Installation, Authentifizierung und deinen ersten API-Aufruf.
Installation
Installiere das Florentin SDK für deine bevorzugte Sprache:
pip install florentinnpm install florentin #
or yarn add florentingo get github.com/florentin/florentin-goAuthentifizierung
Erstelle eine Client-Instanz mit deinem API-Key. Du findest ihn unter Dashboard → Einstellungen → 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_...")Dein erster API-Aufruf
Erfasse die Nutzung für einen Kunden:
# Nutzung erfassen response = client.usage.record(
customer_id="cust_123", product_id="prod_api", quantity=1500, unit="tokens" ) print(f"Erfasst:
{response.quantity} {response.unit}")// Nutzung erfassen const response = await
client.usage.record({ customerId: "cust_123", productId: "prod_api", quantity: 1500, unit: "tokens"
}); console.log(`Erfasst: ${response.quantity} ${response.unit}`);// Nutzung erfassen
response, err := client.Usage.Record(ctx, &florentin.UsageParams{ CustomerID: "cust_123",
ProductID: "prod_api", Quantity: 1500, Unit: "tokens", }) fmt.Printf("Erfasst: %d %s
",
response.Quantity, response.Unit)