LiBilling Anthropic AI package for Ticket functions. https://libilling.com
Find a file
Troy Siedsma f844691fcd LICENSE: Copyright (c) Lithium Holdings, LLC
Normalize the copyright line so every extracted LithiumHosting/* and
LiBilling/* MIT package attributes to Lithium Holdings, LLC (the
corporate entity) instead of the individual author. Third-party
packages preserve the original copyright AND add a Lithium Holdings
modifications line; MIT's notice-preservation requirement is honored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 15:13:46 +00:00
config Re-platform onto LiBilling/libilling-ai-anthropic Forgejo origin 2026-05-22 13:14:20 +00:00
src Re-platform onto LiBilling/libilling-ai-anthropic Forgejo origin 2026-05-22 13:14:20 +00:00
composer.json Standardize composer.json + README + LICENSE 2026-05-22 15:03:54 +00:00
LICENSE.md LICENSE: Copyright (c) Lithium Holdings, LLC 2026-05-22 15:13:46 +00:00
README.md Standardize composer.json + README + LICENSE 2026-05-22 15:03:54 +00:00

LiBilling Anthropic AI Provider

The Anthropic Claude provider for LiBilling's AI Draft Assist subsystem. Self-registers with App\LiBilling\AIProviderRegistry on boot, installing this package and setting LIBILLING_AI_PROVIDER=anthropic is all that is required to enable AI-assisted reply drafting and ticket summarization.

This package is a thin LiBilling adapter. The actual Messages API plumbing lives in lithiumhosting/laravel-anthropic-api; this one composes prompts and maps generic API exceptions into the LiBilling exception hierarchy.

Features

  • Draft generation: AIProvider::draft() via a forced submit_draft tool with draft_text, confidence, clarifying_questions, and flagged_concerns
  • Summarization: AIProvider::summarize() via a forced submit_summary tool with summary and key_points
  • Variable-aware prompting: when a RedactionMap is supplied, the system prompt embeds a glossary instructing the model to use :customerFullName, :domain1, :staffMember1, etc. verbatim
  • Markdown output: drafts are produced as Markdown that drops directly into the Filament reply editor
  • Token + cost metadata: per-call usage tokens are converted to cost_micros via the shared AnthropicModelCatalog for the monthly cost-cap pre-flight
  • Exception mapping: generic AnthropicException subtypes are translated into LiBilling's AIProviderException hierarchy so the host UI's error toasts stay consistent across providers

Installation

This package is loaded as a local Composer path repository. No separate installation is needed when developing within the LiBilling monorepo.

For standalone installation:

composer require libilling/libilling-ai-anthropic

Configuration

Publish the config file:

php artisan vendor:publish --tag=libilling-ai-anthropic-config

Config Options

Key Env Default Description
api_key ANTHROPIC_API_KEY (unset) Required when LIBILLING_AI_PROVIDER=anthropic
model ANTHROPIC_MODEL claude-sonnet-4-6 Model identifier, must exist in AnthropicModelCatalog
version ANTHROPIC_VERSION 2023-06-01 Anthropic API version header
timeout_seconds ANTHROPIC_TIMEOUT_SECONDS 60 Wall-clock timeout for the synchronous API call
max_tokens ANTHROPIC_MAX_TOKENS 2000 Output cap. Sized for a single ticket reply or summary

Usage

Within LiBilling the host resolves app(AIProvider::class) and calls draft() or summarize(); staff never invoke this package directly. The relevant pipeline:

  1. App\Services\AiDraft\GenerateDraft (or GenerateSummary) assembles the request from a Ticket.
  2. App\LiBilling\AI\Redaction\DefaultRedactor rewrites bodies into :variable placeholders and produces a companion RedactionMap.
  3. AnthropicProvider::draftWithMap() / summarizeWithMap() composes the prompt (with the variable glossary), calls AnthropicClient::messages(), and parses the forced tool-use block.
  4. The response is reverse-substituted via RedactionMap::reverse() before staff see it.

For local testing without burning API credits, Http::fake() against api.anthropic.com/v1/messages works against the underlying AnthropicClient.

Capabilities

AIProvider::capabilities() reports:

  • supportsStreaming: false: the provider runs a single synchronous request
  • supportsToolUse: true: responses are always delivered via forced tool use
  • maxContextTokens: pulled from AnthropicModelCatalog for the configured model (200k for the current Claude 4 family)
  • maxOutputTokens: mirrors the max_tokens config

Dependencies

  • lithiumhosting/laravel-anthropic-api: Generic Messages API client (HTTP, errors, model catalog, response normalization)

Testing

vendor/bin/sail artisan test --filter=AnthropicProvider

The host application's tests/Feature/Ai/Anthropic/ suite exercises this package end-to-end against Http::fake().

License

LiBilling is (C) Lithium Holdings, LLC. All components except for third-party modules and select packages with their own license are licensed under a Commercial License. Contact licensing@lithiumholdings.com for licensing enquiries. Any dissemination of material herein is prohibited without expressed written consent of Lithium Holdings.

This package, libilling-ai-anthropic is licensed under The MIT License (MIT). Please see License File for more information.

Is it any good?

Yes.

When people first hear about a new product, they frequently ask if it is any good. A Hacker News user remarked:

Note to self: Starting immediately, all raganwald projects will have a "Is it any good?" section in the readme, and the answer shall be "yes.".