Ganivra

Using Ganivra

User manual

Connect customer revenue, understand your costs, and keep your workspace configuration under control. Product links keep your selected workspace; access permissions still apply.

Get started

Choose the right workspace

  1. Use the workspace selector before inspecting data or changing configuration. Your main workspace is labeled with its actual name followed by (Primary). Additional workspaces have their own events, keys, pricing plans and customer assignments.
  2. The API key determines where usage lands. Metadata cannot redirect it. If recent events are missing, compare the deployed key’s workspace with the selected workspace, then clear filters and refresh.
  3. Additional workspaces linked to your primary workspace share its Ganivra plan allowance. Unrelated accounts are not combined, even if their workspace names match.

Verify your first execution

  1. Open the integration guide and choose outbound calling, an agent workflow, or document processing. Supply customer_id, application, feature and workflow consistently across the model and MCP steps of one business action.
  2. Use one execution_id for the action and distinct event/step IDs for actual calls. Redelivering telemetry must preserve event_id. A real model retry is another call and needs its own event ID.
  3. Open Executions, refresh, and inspect the customer, quantities, model/tool costs and status. A 202 response confirms API acceptance, not that every attribution or pricing field is present. Unknown model pricing needs a rate before contribution is reliable.

Use the Python SDK for integration and administration

  1. Install SDK 0.6.3 for the explicit REST client and current helpers. Automatic capture supports synchronous, non-streaming OpenAI Responses, synchronous OpenAI Chat Completions (streaming included, also for Together AI, Fireworks, DeepInfra and Baseten), and Claude Messages sync, async and streaming with the Anthropic extra. Gemini and unsupported APIs require explicit usage submission.
  2. Use Client(api_key=...) for model/MCP events, revenue entries, transactions and delivery costs. Supply stable IDs and real occurrence timestamps. Keep delivery costs on their separate endpoint and avoid reporting the same charge twice.
  3. Use Client(access_token=..., workspace_id=...) for reports and administration. Supply a signed-in user token or a callback returning the refreshed token, never a service-role secret. Ingestion keys cannot administer plans or read workspace data; existing role checks remain in force.
  4. Manage pricing plans, customer assignments and historical effective dates through pricing_plans and customer_plans. Extend plan dates before an earlier assignment when necessary. Use economics for contract rates, reconciliation and repricing. Date changes affect live plan-based reporting, not original usage or saved statements.
  5. Use delivery_costs for investigations, evidence, invoice policies and snapshots; reports for costs, exports and allocation rules; audit for administrative history; bills, budgets, workspaces and account for their management operations. Use value.list and value.import_assessment for customer value evidence. The integration walkthrough lists the methods and examples.
  6. Pass JSON bodies through payload and query filters through params. Export methods return bytes, pagination is explicit, and HTTP failures expose APIError.status_code, body, headers and retry_after when provided. Writes are not automatically retried: reuse stable IDs for ingestion and inspect state before repeating non-idempotent changes.

Track Claude Code, Codex and other tools with OpenTelemetry

  1. Use OpenTelemetry when a tool already exports it, such as Claude Code, GitHub Copilot or an app instrumented with GenAI spans, and you do not want to add the SDK. Generate a workspace API key in Profile & setup; the key decides which workspace receives the usage.
  2. Set OTEL_EXPORTER_OTLP_ENDPOINT to https://api.ganivra.com/v1/otlp, OTEL_EXPORTER_OTLP_PROTOCOL to http/protobuf or http/json, and OTEL_EXPORTER_OTLP_HEADERS to Authorization=Bearer followed by your key. gRPC is not supported. For Claude Code, also set CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_LOGS_EXPORTER=otlp and OTEL_METRICS_EXPORTER=otlp (lines changed, commits and active time for Agent health; usage metrics are not counted twice), and set OTEL_LOGS_EXPORT_INTERVAL=60000 so each developer sends one request a minute.
  3. Each Claude Code API request becomes one event: the developer's email is the user, the session is the conversation and each prompt is one execution. Add your own grouping with OTEL_RESOURCE_ATTRIBUTES, for example team.id=platform,cost_center=eng-123; those keys appear as attributes you can filter by. Calls to Anthropic's API are priced from Ganivra's rates; on Bedrock or Vertex AI, Ganivra keeps the cost Claude Code reports.
  4. For OpenAI Codex, edit ~/.codex/config.toml on each machine (a project's .codex/config.toml cannot set telemetry). Add an [otel] table with log_user_prompt = false, and an [otel.exporter.otlp-http] table with endpoint = "https://api.ganivra.com/v1/otlp/v1/logs", protocol = "binary" and headers = { Authorization = "Bearer " followed by your key }. Write the key itself, because Codex does not expand ${VARIABLES} in headers. Each completed model response becomes one event priced at OpenAI's list rate, including cached input and reasoning tokens; the developer is the ChatGPT email or account ID. Codex reports no git repository, so set team and project labels with OTEL_RESOURCE_ATTRIBUTES in the shell before starting codex.
  5. For your own app, Ganivra reads chat, generate_content, text_completion and embeddings spans that carry gen_ai.usage token counts. Agent and tool spans are skipped so totals are not counted twice. Add ganivra.customer_id, ganivra.workflow, ganivra.feature and ganivra.plan_key as span or resource attributes to connect usage to customers and plans. Prompt and response content is never stored.
  6. To check the connection, run one call, then open Executions in the same workspace. Executions from OpenTelemetry have IDs starting with otel- for spans, cc- for Claude Code and cx- for Codex. If nothing arrives, check the endpoint path, the protocol and the Authorization header; a 415 response means the exporter is using gRPC.
  7. Quickest setup on macOS or Linux: run curl -fsSL https://ganivra.com/install.sh | sh on each developer's machine. It finds Claude Code and Codex, asks for your workspace key once and configures both. Then run ganivra label --project name --client name in each repository and commit the .claude/settings.json it writes; ganivra status shows what is connected.
  8. Label each project once, in the project: commit a .claude/settings.json to each repository whose env sets OTEL_RESOURCE_ATTRIBUTES to team.id=…,project=…,client=… on one line. Claude Code applies it in the terminal, IDE and desktop app once the folder is trusted, and every developer on the repository sends the same labels. Keep the endpoint and key in user-level settings. For the Codex CLI, the integration guide's codex shell function reads the same file; for the Codex desktop app, assign projects in Coding agents → Sessions.
  9. Rolling out to a whole team? Open Coding agents, then Seats & adoption, to see active developers by week. Owners and admins can paste the seat list from the Claude or ChatGPT admin console as email, tool, plan, monthly price: Ganivra then shows seats in use and idle, what idle seats cost a month, and a seat fit for each one (No usage, Light, Good fit or Heavy), comparing the seat price with that developer's usage at API rates. Saving replaces the whole list.
  10. Open Dashboard, then Coding agents, to see Claude Code and Codex spend by developer, team, project, model and tool, with cost per million tokens. Choose a model under Re-price this usage on to see what the same tokens would cost on Claude Sonnet or Haiku 5.5, GPT-6.1 Sol or Terra, GPT-6 Luna, Gemini 4 Argon or an open model such as Kimi K3.1 Pro, GLM-5.3 or DeepSeek V4.1 Flash, or choose Your own GPUs and enter a cost per million tokens for a self-hosted model. Teams come from team.id, team or cost_center resource attributes. Choose Projects to see cost per ganivra.workflow label, git repository (set OTEL_METRICS_INCLUDE_REPOSITORY=true) or the workspace folder name when a Claude desktop session reports one (the full path is never stored); to name a Claude Code project yourself, set OTEL_RESOURCE_ATTRIBUTES with ganivra.workflow in that folder's .claude/settings.local.json, with the client from ganivra.customer_id. In Sessions, owners and admins can set the project and client of any Claude Code or Codex session, including past ones; it applies to later requests in that session too, and Reset restores the reported labels. The keys project= and client= work as shorter forms of ganivra.workflow and ganivra.customer_id. Download the table as CSV for chargeback, and in Reports add allocation rules that map a team or developer to a cost centre.
  11. Choose Agent health to see how Claude Code sessions go, by developer, project or main model: friction per prompt (tool calls that failed, that the developer rejected or stopped), the share of tool calls that failed, context compactions, net lines changed, sessions ending in a commit or pull request, and the developer's share of active time against the agent's. Sessions with 3 or more failed tool calls in a row, or 3 or more rejected or stopped calls, are listed as high friction, with whether they ended in a commit. Tool events come with the logs export; lines, commits and active time need OTEL_METRICS_EXPORTER=otlp. Prompt text, file paths and tool input are never stored.

Revenue and plans

Configure customer plans and assignments

  1. In Settings → Define customer pricing, enter a name, a stable key such as starter or growth, a pricing model and its rates. Choose subscription, per execution, per token, credit/unit, or hybrid. This is what your customers pay you, separate from your Ganivra subscription.
  2. Automatic mapping: send attributes.customer_id plus attributes.plan_key. A matching effective plan in the same workspace is used without a manual assignment. Rates are configured in Ganivra; the event sends the key and usage.
  3. Manual mapping remains available: use Assign a customer (optional), enter the exact customer ID and choose the plan. Events may omit plan_key. An explicit key takes precedence; an invalid key produces a warning instead of silently using the assignment.
  4. Credit/unit plans also need actual execution-level quantity in the configured unit_attribute, such as credits or pages_processed. The maximum quantity across steps is used, not their sum. Send the final total when known; zero is a valid quantity.
  5. To change a customer’s plan, send the new configured key on future executions or change its assignment. Earlier events retain their supplied keys. Stored keys are not immutable rate snapshots: updating an existing plan can change recalculated history. Use a distinct key for a new rate version when preserving the old rate matters.
  6. The Settings form creates plans and assignments; it does not offer a full historical plan editor or effective-date controls. Use the documented pricing-plan/customer-plan API for explicit effective dates and existing-key updates. Creating a plan with an existing key updates that plan, so review historical impact before submitting.

Cover historical executions with the correct plan dates

  1. Open Settings → Customer pricing → Review effective dates and historical coverage. Expand the customer assignment and set the actual effective start and optional end. All inputs are UTC; the end is exclusive.
  2. If the pricing plan itself starts too late, expand Plan availability dates and extend it first. Plan date changes affect every customer using that plan. Assignment periods cannot overlap; adjust an adjacent assignment first when needed.
  3. Save and refresh Customer economics. Live plan-based revenue is recalculated, including monthly subscription allocation. Usage records, confirmed revenue entries, and saved statements are not rewritten. Administrative history records the date change.
  4. The missing-revenue warning shows the execution timestamp and applicable date ranges. Use Inspect execution to verify the historical action before changing its coverage. Explicit event plan keys still take precedence over manual assignments.

Resolve missing revenue

  1. Customer economics → Connect missing revenue lists affected customers, plan keys and execution counts. Usage and costs remain stored while setup is incomplete.
  2. Plan not configured: create the exact key in the receiving workspace, with dates covering the events, then refresh. Existing usage can be calculated without resending events. No rates are inferred from a name like growth.
  3. Plan or assignment date mismatch: review the occurrence timestamp and effective dates. Effective periods include their start and exclude their end.
  4. Missing or invalid units: send the configured quantity as a finite, non-negative number. Resending the same event ID with changed attributes does not amend the stored event; investigate the affected execution before correcting the integration.
  5. Missing customer or conflicting attribution: use the paying tenant’s stable ID, and one customer and plan across an execution. Unsupported plan currency requires a USD plan or converted revenue reporting.
  6. Unknown revenue means no applicable revenue was found, not a confirmed zero. Partial revenue means some executions remain unresolved; contribution stays unknown in the customer economics table. Confirmed revenue takes precedence over applicable plan estimates.

Connect payments, bills and reconciliation

  1. Import billing actuals in Settings or report confirmed purchases, subscription payments, credit purchases and refunds through the Transactions API. Use the same customer ID, and execution_id when a payment belongs to one result. These records report money movement; Ganivra does not charge the customer.
  2. For subscriptions, send transaction_type: subscription_payment for each confirmed payment or renewal. Use a unique payment or paid invoice ID as external_id, not the recurring subscription ID. Omit execution_id for a general subscription.
  3. For a one-time purchase, send transaction_type: one_time_purchase with the confirmed amount and currency. Include the original execution_id when the payment belongs to one AI result. Use the server-side workspace key and reuse external_id on retries; occurred_at should remain the actual payment time. Currency defaults to USD. Other currencies are displayed as supplied. Without a conversion value, revenue and USD costs are compared as raw numbers with a normalization warning. Supply amount_usd or exchange_rate_to_usd to normalize.
  4. In Bills, preview a supported CSV or add manual costs. Additional delivery costs can contribute to workspace economics; AI invoice references avoid adding a second copy of telemetry cost. Shared bills are not automatically allocated to customer/feature margins.
  5. Use Reconcile a provider invoice in Settings or Cost reports to compare recorded provider totals with estimated costs for the same period. Investigate variance, unpriced usage and incomplete coverage. Provider invoice synchronization and line-by-line matching are not automatic.
  6. Cost reports provide exportable evidence. Treat reconciled/fully priced status as scoped to supplied records, not proof of complete financial accounting.

Margins and costs

Review customer and workflow margins

  1. The dashboard opens on Customer economics. Select a period and customer, then inspect workflow and feature rows. View executions opens the underlying calls with the same workspace, period and filters. Use Clear filters and Refresh data to return to a fresh view.
  2. Contribution after recorded costs = connected revenue minus the recorded costs included in the view. Contribution margin = contribution divided by revenue. These are not total company profit or necessarily complete gross margin: missing or unallocated delivery costs can materially change the result.
  3. Revenue basis distinguishes reported revenue, calculated plan revenue, allocated subscription revenue and refunds. Workflow revenue may be allocated across executions; it is not necessarily a direct payment for that workflow.
  4. Inspect coverage before interpreting a positive margin. Recorded calls priced means the calls received have rates; it does not prove every call, retrieval, telephony or compute cost was captured. Unattributed rows need customer/feature/workflow context.
  5. The margin target defaults to 60% and can be changed in the dashboard. It is a comparison threshold, not the calculated margin, price, or spending cap. It resets on reload.
  6. Margin outlook estimates month-end economics from recent recorded usage where coverage supports a forecast. Insufficient data is an expected result for sparse or incomplete history. Forecasts are assumptions, not guarantees; they exclude unallocated delivery costs.

Explain changes in customer economics

  1. Open Why did economics change? from Dashboard or Delivery costs. Choose the current period and optionally a customer and workflow. The comparison uses the immediately preceding equal-length period; end dates are exclusive.
  2. Review revenue, recorded delivery cost, and contribution differences. Category deltas add up to recorded cost change. The separate model/tool decomposition splits its cost change into execution volume at the old average cost and the remaining average-cost effect. Do not add that decomposition to category deltas again.
  3. Inspect changed token usage, errors and model lists, affected customers/workflows, and representative records. Administrative changes are workspace-wide context, with actors and snapshots; timing does not establish causation.
  4. Follow execution and cost-evidence links. Invoice allocations include the source bill. Missing revenue, small samples and unpriced costs are explicit limitations. Periods use current stored configuration, not historical as-of pricing; saved delivery statements preserve prior reports.

Review recorded delivery costs

  1. Open Delivery costs for a combined view of model/tool telemetry, external service events, and imported delivery bills. Select a period, customer, workflow, agent, feature, or execution. These are recorded costs, not a guarantee that all costs were captured.
  2. Record telephony, speech, OCR, search, retrieval, compute, storage, network, or external-tool events through the SDK/API or event import. Supply a stable provider event ID, occurrence timestamp, source reference, attribution, and either a USD amount or quantity with a versioned unit rate. Do not report the same charge through model/MCP telemetry and delivery events.
  3. Match imported invoice lines to existing delivery-event IDs to verify costs without adding the bill again. Provider and service period must match. Differences stay visible; record an explicit signed correction to adjust costs. Matching by itself never changes usage facts.
  4. For genuinely additional shared costs, allocate an imported bill using customer percentages and a documented basis. Percentages apply to the bill's workspace share, cannot exceed 100%, and the remainder stays unallocated. These allocations are estimates, even when based on measured usage.
  5. Export evidence or save a workspace statement. Saved statements preserve the original numbers; late events and corrections change the live report only. Save a new statement and compare evidence when restating a period. This is not an invoice or an accounting-period lock.
  6. Agent views do not allocate revenue. Customer contribution can exclude unallocated costs. Model-only dashboards and budgets retain their existing scope; use Delivery costs for the expanded report.

A practical weekly review

  1. Check the selected workspace and refresh. Resolve missing customer IDs, plan warnings and unpriced calls first.
  2. Review customers with unknown or negative contribution; inspect their workflow/feature costs and underlying executions. Compare equivalent periods before changing pricing or implementation.
  3. Review budget alerts and record decisions. Compare provider invoices with telemetry, and confirm actual revenue is current.
  4. Review shared plan consumption and administrative changes. Use Value measurement separately when you want to assess customer outcomes or ROI; its assumptions are not automatic proof of realized value.

Run your workspace

Manage budgets and review alerts

  1. Open Budgets and choose a workspace-wide budget or a supported dimension such as customer, feature or workflow. Set an accountable owner, USD amount, period and thresholds. Defaults are 80% warning and 100% critical.
  2. Review unpriced usage as well as known spend. Owners/admins can record Acknowledge, Investigate, Action required or Approve exception with a reason. An exception records a decision; it does not increase the budget or suppress future alerts.
  3. Budget dates and thresholds are fixed after creation; archive and replace a budget to change them. History remains available. Overlapping budgets measure overlapping costs and should not be summed.
  4. Use Refresh budgets to evaluate current conditions. These are in-app review controls, not provider spending caps or email/Slack notifications. Viewers can inspect history but cannot perform administrative actions.

Review your Ganivra plan consumption

  1. In Settings → Plan consumption, the subscription owner sees one shared allowance across the primary workspace and its linked additional workspaces, with a workspace breakdown.
  2. Each accepted model call and each MCP call counts once. One execution may contain many calls. Dashboard filters and key rotation do not change consumption. Duplicate event IDs within a workspace are not counted again; the same ID in another workspace is separate.
  3. Consumption uses server receipt time and the configured billing period. Economics uses event occurrence time, so delayed events can appear in different periods in these two views. Sample events also count.
  4. Paid periods must be configured; they do not renew automatically. Without a subscription record, the account uses the trial rules. Delegated access to a client workspace does not expose account-wide usage. Usage tracking does not enable automated charging or hard limits.

Read administrative history

  1. Open Administrative history to investigate configuration changes: who created or revoked a key, changed customer pricing, modified access, or exported records. It complements Executions, which records what the application did.
  2. Rows use readable actions and current workspace member emails where available. A user ID is the fallback. View details shows before/after changes and record IDs; Technical evidence exposes the stored JSON snapshot.
  3. Filter by change type, user ID and UTC dates. Before (UTC) is an exclusive end boundary. Clear filters resets the view. Export filtered CSV downloads matching records within the export limit; exports are themselves recorded.
  4. History begins when auditing was enabled; earlier actions are not reconstructed. A key rotation can produce separate revoked-key and created-key entries. These entries do not prove the replacement key was deployed or that telemetry arrived.

Correct usage and inspect pricing history

  1. An administrator can submit a complete corrected event through POST /v1/events/{event_id}/corrections or the SDK events.correct helper. Preserve event_id, supply the actual occurrence timestamp, and include a stable request UUID and a specific reason. This is an API workflow, not an edit button in the dashboard.
  2. The current event is updated without adding a call. Original facts and before/after evidence remain available through GET /v1/events/{event_id}/history or events.history with a signed-in user token. Original ingestion retries cannot undo a correction. Changed payloads under an existing ingestion ID return HTTP 409.
  3. Historical repricing now records before/after pricing in the same history. Evidence begins at deployment; earlier overwritten prices cannot be reconstructed. Live reporting changes, but confirmed revenue entries, saved statements and external invoices need separate review.
  4. Revenue imports are atomic: either the whole request commits or none of it does. Investigate a conflict before retrying; preserve IDs and payloads when retrying an uncertain delivery.

More

Price self-hosted models on your own GPUs

  1. Use this when you run DeepSeek, GLM, Qwen or your own model on vLLM, SGLang or another OpenAI-compatible server on GPUs you rent or own. You pay for those GPUs by the hour, busy or idle, so there is no list price per call.
  2. Send those calls with provider self_hosted and your model ID. With the Python SDK, list your model servers once: ganivra.init(api_key=..., self_hosted_hosts=["vllm.internal"]). Calls to those hosts are then recorded as self_hosted automatically. With REST, set "provider": "self_hosted".
  3. Open Dashboard, then Own GPUs, and add a GPU pool: GPU type, number of GPUs, price per GPU-hour (pick a list price or enter your contract rate) and the date it started running. Optionally list the models it serves and choose a hosted API model to compare with.
  4. Ganivra splits each UTC day's GPU cost across that day's calls by weighted tokens, with output tokens counted 4 times. Per-call costs add up to the GPU bill, so Customer economics, Cost breakdowns and Executions show cost per customer, feature and team as they do for API calls. New calls use the latest finished day's rate until the hourly split updates them; today's figures change until midnight UTC.
  5. For a split by real GPU time, send vLLM's own traces: start vLLM with --otlp-traces-endpoint https://api.ganivra.com/v1/otlp/v1/traces, OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf and OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer gv_…". Each trace is matched to its call by the response id, which the SDK sends as attributes.request_id (with REST, send it yourself). Traces add no calls of their own. A matched call's share is its time in the model.
  6. For utilization, run an OpenTelemetry Collector that scrapes NVIDIA's DCGM exporter (or vLLM's /metrics if you have no DCGM) and exports to https://api.ganivra.com/v1/otlp, adding the resource attribute ganivra.gpu_pool set to the pool's name. Each hour's unused share becomes idle cost. Tick 'The cluster autoscales' on a pool to bill each hour for the GPUs the metrics saw.
  7. The Own GPUs view shows each pool's cost for the last 30 days, idle cost, utilization, the share of calls split by GPU time, the effective cost per million tokens and what it would be at 80% utilization, and what the same tokens would cost on the hosted API you chose. To change a pool's size or price, end it and add a new one, so earlier days keep their cost. Changes to a finished day's costs are recorded in each call's history. A contract rate or provider-reported cost for a model still takes precedence. The i button lists the limits of these estimates.
  8. To see which API features would be cheaper on your GPUs, use 'Which API features would cost less on your GPUs?' in the same view. Compare with a pool that has GPU metrics, or with GPUs you are considering (price per GPU-hour and tokens per second per GPU at full load). Each feature's last 30 days of API tokens are priced at 80% utilization. A pool's spare capacity is filled first, biggest saving per token first, at no extra GPU cost; the rest would need whole new GPUs, and the plan says whether those pay off. It compares cost only, not model quality.
  9. If you rent GPUs to one customer, enter their customer ID under 'Rented to one customer' when adding the pool, and optionally the price you charge per GPU-hour. That pool then serves only that customer's calls, before any shared pool, and every hour of it is their cost, including days nobody used it. The pool card shows the margin on that customer, and 'Customers renting dedicated GPUs' lists each one's GPU cost, idle cost, what they were charged and the margin. Margin stays empty until every pool of theirs has a price. Their other calls stay on shared pools.
  10. Customer economics, the dashboard totals and trends, and the delivery report include the rental: each day's GPU-hours at your price is that customer's revenue, and a day without calls adds its GPU cost to them. Calls on rented GPUs with a price need no pricing plan, and a plan does not charge for them again. Imported billing actuals for that customer's month replace the rental revenue, as they replace plan revenue. The model comparison, margin outlook and cohorts leave rental revenue out, because they work call by call. Ganivra does not invoice the rental.