AiProxy

class AiProxy : AI

CodBi / AI Proxy — Authenticated reverse proxy to local LLAMA-server, Whisper-server, and

Tesseract OCR.

Servlet that proxies HTTP requests from authenticated external clients to local AI servers managed by LLAMA and Whisper, and to the in-process TesseractAction OCR engine. Provides IP-based access control, multi-user Basic Auth, and anonymised request logging into the Formcycle database.

Exposes the following endpoints through Formcycle's HTTP stack:

POST  /plugin?name=CodBi_AI_Proxy&endpoint=/v1/chat/completions
POST  /plugin?name=CodBi_AI_Proxy&endpoint=/completion
POST  /plugin?name=CodBi_AI_Proxy&endpoint=/v1/audio/transcriptions
POST  /plugin?name=CodBi_AI_Proxy&endpoint=/v1/ocr

LLAMA and Whisper requests are forwarded via HTTP to their respective local server processes. Tesseract requests are handled in-process via JNI (no external server) through TesseractAction.performOcr.

Security is enforced via:

  • IP whitelist → plugin property AI_Proxy_AllowedIPs

  • HTTP Basic Auth → plugin property AI_Proxy_Users

Every request is logged to the Formcycle database table codbi_ai_proxy with anonymised caller information (SHA-256 of username, first two octets of IP).

Plugin properties

PropertyFormatExample
AI_Proxy_AllowedIPsComma-separated IPs / CIDRs192.168.1.0/24,10.0.0.5
AI_Proxy_UsersComma-separated user:passalice:secret1,bob:secret2

Database

The audit table codbi_ai_proxy is managed by CodbiEntities using Formcycle's IPluginEntities API — the audit table schema is managed by Liquibase and data access uses JPA.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open override fun execute(params: IPluginServletActionParams): IPluginServletActionRetVal

Processes an incoming proxy request.

Link copied to clipboard
Link copied to clipboard
open override fun getDisplayName(p0: Locale): String
Link copied to clipboard
open override fun getName(): String

The name of this servlet.

Link copied to clipboard
open override fun initialize(configData: IPluginInitializeData)

Reads plugin properties for IP whitelist and user credentials. Database setup is handled separately by CodbiEntities.

Link copied to clipboard
open fun initPlugin()
Link copied to clipboard
open fun install(p0: IPluginInstallData)
Link copied to clipboard
open override fun shutdown(shutdownData: IPluginShutdownData?)

Initiates a task that removes unused images that're expired (msExpirationIDedImages) from the cache (cacheIDedImages).

open fun shutdown()
Link copied to clipboard

Initiates a task that removes unused images that're expired (msExpirationIDedImages) from the cache (cacheIDedImages).

Link copied to clipboard
open fun uninstall(p0: IPluginUninstallData)
Link copied to clipboard
open override fun validateConfigurationData(configData: IPluginValidationData): IPluginInitializeValidationResult?

Rejects tenant-level installation. CodBi must be installed as a system plugin because its AI services (Whisper, LLAMA) bind local server ports and manage heavyweight processes that would conflict when instantiated once per tenant.