POST /api/v1/integrations/llm-usage stores priced LLM usage events (idempotent on gateway_request_id) in llm_usage_events. The gateway is the LLM-pricing authority — arcadia-cloud trusts the charge it sends rather than re-pricing. The monthly invoice rollup now appends an llm_usage line per deployment alongside the infra quote lines; the exact decimal charges are summed and rounded to cents once. Closes the gateway→cloud billing loop. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
49 lines
1.4 KiB
Elixir
49 lines
1.4 KiB
Elixir
defmodule ArcadiaCloudWeb.Router do
|
|
use ArcadiaCloudWeb, :router
|
|
|
|
pipeline :api do
|
|
plug :accepts, ["json"]
|
|
end
|
|
|
|
pipeline :authed do
|
|
plug ArcadiaCloudWeb.Plugs.RequireAuth
|
|
end
|
|
|
|
scope "/api", ArcadiaCloudWeb do
|
|
pipe_through :api
|
|
|
|
get "/health", HealthController, :show
|
|
end
|
|
|
|
scope "/api/v1", ArcadiaCloudWeb do
|
|
pipe_through [:api, :authed]
|
|
|
|
get "/inventory", InventoryController, :index
|
|
|
|
get "/billing/balance", BillingController, :balance
|
|
get "/billing/cost-lines", BillingController, :cost_lines
|
|
|
|
get "/drift", DriftController, :index
|
|
post "/drift/:id/accept", DriftController, :accept
|
|
|
|
get "/catalog/plans", CatalogController, :plans
|
|
get "/catalog/addons", CatalogController, :addons
|
|
|
|
post "/quote", QuoteController, :create
|
|
|
|
get "/deployments", DeploymentController, :index
|
|
post "/deployments", DeploymentController, :create
|
|
get "/deployments/:id", DeploymentController, :show
|
|
post "/deployments/:id/transition", DeploymentController, :transition
|
|
post "/deployments/:id/subscribe", DeploymentController, :subscribe
|
|
|
|
get "/invoices", InvoiceController, :index
|
|
get "/invoices/:id", InvoiceController, :show
|
|
|
|
get "/dashboard/margin", DashboardController, :margin
|
|
get "/dashboard/accrual", DashboardController, :accrual
|
|
|
|
post "/integrations/llm-usage", IntegrationsController, :llm_usage
|
|
end
|
|
end
|