# PhoenixKitAI v0.26.1 - Table of Contents > AI module for PhoenixKit — endpoints, prompts, completions, and usage tracking ## Modules - [PhoenixKitAI](PhoenixKitAI.md): Main context for PhoenixKit AI system. - [PhoenixKitAI.AIModel](PhoenixKitAI.AIModel.md): Struct representing a normalized AI model from the OpenRouter API. - [PhoenixKitAI.AnthropicPricing](PhoenixKitAI.AnthropicPricing.md): What a chat call to Anthropic cost, from its token counts and a rate table. - [PhoenixKitAI.Budget](PhoenixKitAI.Budget.md): Spend caps over the trailing 24 hours, checked before every provider call. - [PhoenixKitAI.Cache](PhoenixKitAI.Cache.md): Short-lived node-local cache for the two lookups every provider call repeats: the endpoint row (`resolve_endpoint/1` by uuid) and its integration credentials (`PhoenixKit.Integrations.get_credentials/1` — a settings read plus a decrypt, done once to validate the endpoint and again to build the request headers). - [PhoenixKitAI.CallCost](PhoenixKitAI.CallCost.md): What a call cost, in US dollars (`Request.cost`, a `Decimal`), and where the figure came from. The first source that has a price wins - [PhoenixKitAI.Capabilities](PhoenixKitAI.Capabilities.md): What a model can do — images in, documents in, images out, tools, a strict JSON schema, any JSON — as the provider's catalogue says, or as an admin declared it on the endpoint where the catalogue says nothing. - [PhoenixKitAI.Completion](PhoenixKitAI.Completion.md): OpenRouter completion client for making AI API calls. - [PhoenixKitAI.Components.AITranslate](PhoenixKitAI.Components.AITranslate.md): Shared AI-translation UI for multilang form LiveViews — the publishing/projects-style trigger button + modal, on top of core's `PhoenixKitAI.Translations` pipeline. - [PhoenixKitAI.Endpoint](PhoenixKitAI.Endpoint.md): AI endpoint schema for PhoenixKit AI system. - [PhoenixKitAI.Errors](PhoenixKitAI.Errors.md): Central mapping from error atoms (returned by the AI module's public API) to translated human-readable strings. - [PhoenixKitAI.Gettext](PhoenixKitAI.Gettext.md): Gettext backend for `phoenix_kit_ai`. - [PhoenixKitAI.Guard](PhoenixKitAI.Guard.md): The call-time check every provider-calling verb passes before its HTTP request: does the model behind the endpoint (or the call's `model:` override) have what the call and its task need. - [PhoenixKitAI.GuardBlock](PhoenixKitAI.GuardBlock.md): A person blocked from a group of AI tasks until the block is lifted (`phoenix_kit_ai_guard_blocks`, this module's migration chain), written by `PhoenixKitAI.GuardBlocks`. - [PhoenixKitAI.GuardBlocks](PhoenixKitAI.GuardBlocks.md): Blocks: a person may not call a group of AI tasks until the block is lifted (`PhoenixKitAI.GuardBlock`). A person sets them — there is no automatic block. - [PhoenixKitAI.GuardEvent](PhoenixKitAI.GuardEvent.md): Something the AI task guard noticed (`phoenix_kit_ai_guard_events`, this module's migration chain), written by `PhoenixKitAI.GuardEvents`. - [PhoenixKitAI.GuardEvents](PhoenixKitAI.GuardEvents.md): What the AI task guard noticed (`PhoenixKitAI.GuardEvent`) and who is told. - [PhoenixKitAI.GuardWatch](PhoenixKitAI.GuardWatch.md): Notices when a task's model stops fitting it, and signals it (`PhoenixKitAI.GuardEvents.model_unfit/4`: one event a day per task and endpoint). - [PhoenixKitAI.Images](PhoenixKitAI.Images.md): Generic image processing over any provider: named operations composed into one edit, vision (describe an image, optionally as JSON), and a before/after check. - [PhoenixKitAI.Images.ImageModel](PhoenixKitAI.Images.ImageModel.md): What one image model accepts, in provider-neutral terms. - [PhoenixKitAI.Images.ImageModels](PhoenixKitAI.Images.ImageModels.md): A provider's image models and what each accepts, cached per base URL. - [PhoenixKitAI.Images.Operations](PhoenixKitAI.Images.Operations.md): The named image operations `PhoenixKitAI.Images.process/4` composes into one edit prompt. - [PhoenixKitAI.Limiter](PhoenixKitAI.Limiter.md): Caps how many provider calls run at once per key, and lines up the rest in arrival order. - [PhoenixKitAI.ManualPrice](PhoenixKitAI.ManualPrice.md): A price entered by hand on an endpoint whose provider gives none (Z.ai, say): `provider_settings["pricing"]` — `%{"model" => id, "input" => "0.60", "output" => "2.2"}`, US dollars per 1M input and output tokens as decimal strings (a JSON number would read back as a float), both required, for the model it names. The endpoint's changeset stamps the model when none is given and drops the price when the endpoint's model changes (like a capability declaration). - [PhoenixKitAI.Migrations](PhoenixKitAI.Migrations.md): Module-owned versioned migrations for `phoenix_kit_ai` — the protocol core's `mix phoenix_kit.update` discovers through `PhoenixKitAI.migration_module/0` (`current_version/0`, `migrated_version_runtime/1`, `up/1`, `down/1`). Same shape as `PhoenixKitAgent.Migrations`: two version readers, `up/1` re-reading the version before it changes anything, the SQL kept as data (`up_statements/2`, `down_statements/2`). - [PhoenixKitAI.ModelCapability](PhoenixKitAI.ModelCapability.md): One row of the capability snapshot (`phoenix_kit_ai_model_capabilities`, this module's own migration chain): what the catalogue said a model can do, for a model an endpoint uses, keyed by the endpoint's resolved base URL. - [PhoenixKitAI.Money](PhoenixKitAI.Money.md): Money as the module keeps it: an amount of US dollars as a `Decimal`, never a float and never a scaled integer. A call's cost (`Request.cost`), the spend caps (`PhoenixKitAI.Budget`), the task limits (`PhoenixKitAI.TaskLimits`) and the prices per 1M tokens (`PhoenixKitAI.ManualPrice`) are all plain dollars. - [PhoenixKitAI.OpenRouterClient](PhoenixKitAI.OpenRouterClient.md): OpenRouter API client for PhoenixKit AI system. - [PhoenixKitAI.Prompt](PhoenixKitAI.Prompt.md): AI prompt schema for PhoenixKit AI system. - [PhoenixKitAI.Provider](PhoenixKitAI.Provider.md): The seam between the public image API and one provider's HTTP shape. - [PhoenixKitAI.Providers.OpenAI](PhoenixKitAI.Providers.OpenAI.md): `PhoenixKitAI.Provider` adapter for OpenAI's own Images API. - [PhoenixKitAI.Providers.OpenAICompatible](PhoenixKitAI.Providers.OpenAICompatible.md): The default `PhoenixKitAI.Provider` adapter: what any OpenAI-shaped API offers with no provider-specific knowledge. - [PhoenixKitAI.Providers.OpenRouter](PhoenixKitAI.Providers.OpenRouter.md): `PhoenixKitAI.Provider` adapter for OpenRouter's unified Images API. - [PhoenixKitAI.Providers.XAI](PhoenixKitAI.Providers.XAI.md): `PhoenixKitAI.Provider` adapter for xAI's image endpoints. - [PhoenixKitAI.Realtime.Session](PhoenixKitAI.Realtime.Session.md): Owns one xAI realtime WebSocket connection (`Xai.Realtime`) on behalf of a single Playground LiveView, forwarding audio chunks and events to it as plain messages. - [PhoenixKitAI.Recommendations](PhoenixKitAI.Recommendations.md): What to choose for an AI task, from live data only — there is no list of "best models" in the module. What a model can do comes first, its price second. - [PhoenixKitAI.Request](PhoenixKitAI.Request.md): AI request schema for PhoenixKit AI system. - [PhoenixKitAI.RequestCache](PhoenixKitAI.RequestCache.md): A write-once cache for provider answers, keyed on what would be sent. - [PhoenixKitAI.RequestLog](PhoenixKitAI.RequestLog.md): Writes usage rows (`phoenix_kit_ai_requests`) off the caller's process. - [PhoenixKitAI.Routes](PhoenixKitAI.Routes.md): Route module for PhoenixKit AI admin routes. - [PhoenixKitAI.StructuredOutput](PhoenixKitAI.StructuredOutput.md): Machine-readable answers from chat models, shared by `PhoenixKitAI.ask/3`, `PhoenixKitAI.complete/3` and `PhoenixKitAI.describe_image/3`. - [PhoenixKitAI.TaskLimits](PhoenixKitAI.TaskLimits.md): The limits of an AI task: how much the task may use, and how much each user may use in it, in a calendar day and month of the site time zone. - [PhoenixKitAI.TaskSetting](PhoenixKitAI.TaskSetting.md): What an admin set for an AI task (`phoenix_kit_ai_task_settings`, this module's migration chain): one row per task key. Written through `PhoenixKitAI.TaskLimits`, which checks the `ai.manage` permission. - [PhoenixKitAI.TaskSpec](PhoenixKitAI.TaskSpec.md): The declaration of an AI task: a named use of AI that a module's code makes, returned by the module's `ai_tasks/0` callback and found by `PhoenixKitAI.Tasks`. - [PhoenixKitAI.TaskUserLimit](PhoenixKitAI.TaskUserLimit.md): A user's personal limits in an AI task (`phoenix_kit_ai_task_user_limits`, this module's migration chain): `limits` is `%{unit => %{period => amount}}`, each amount set here overriding the task's default for its users (`PhoenixKitAI.TaskLimits`). Deleted with the user. - [PhoenixKitAI.Tasks](PhoenixKitAI.Tasks.md): The registry of AI tasks (`PhoenixKitAI.TaskSpec`) and whether an endpoint fits one. - [PhoenixKitAI.Translatable](PhoenixKitAI.Translatable.md): Behaviour a feature module implements to make a resource AI-translatable through core's generic translation pipeline (`PhoenixKitAI.TranslateWorker` + `PhoenixKitAI.Translations`). - [PhoenixKitAI.Translatables](PhoenixKitAI.Translatables.md): Discovery for AI-translatable adapters. - [PhoenixKitAI.Translation](PhoenixKitAI.Translation.md): Generic AI translation helper. Translates a `%{field_name => text}` map from `source_lang` to `target_lang` using PhoenixKitAI's endpoint and prompt system, and parses the structured response back into the same shape. - [PhoenixKitAI.TranslationSweep](PhoenixKitAI.TranslationSweep.md): The background top-up of AI translations a module can switch on: a self-rescheduling Oban chain that, every few minutes, enqueues `PhoenixKitAI.TranslateWorker` jobs for the translations its resources are missing or have let go stale. - [PhoenixKitAI.Translations](PhoenixKitAI.Translations.md): Orchestration for AI-driven translation — the shared layer every feature module enqueues against instead of re-implementing its own context + worker. - [PhoenixKitAI.TtsPricing](PhoenixKitAI.TtsPricing.md): Estimated per-request cost for a completed TTS request, in US dollars (`Request.cost`, a `Decimal`, as for chat/embeddings).