Skip to content

Cost management

P2Lab AI has a built-in cost estimator. Every chat completion, image edit and web-search call has its cost computed and stored alongside the result. You can review spend by request type in the AI Assistant module and use the figures to budget before running a large job.

The estimator uses the pricing fields you configured on each connection model (see Connections):

  • Chat completions(tokensIn × inputPerMTok + tokensOut × outputPerMTok) / 1_000_000
  • Web search — chat formula above, plus webSearchCallCost for each web_search tool invocation the model made
  • Image editsimageEditCost per /images/edits call

Token counts come straight from OpenAI’s response (usage.prompt_tokens, usage.completion_tokens). Costs are stored on every job, every suggestion and every API log row.

  • Per suggestion — the suggestion grid on the jobs detail page has a Cost column.
  • Per job — the job summary card has total tokens and estimated total cost.
  • Per call — the API log (AI Assistant → API logs) records every individual call with its tokens, duration, response code and cost.
  • Aggregate — the Cost statistics card on the AI Assistant dashboard plots daily spend grouped by request type for the last 7 / 14 / 30 / 90 days.

When creating a job from AI Assistant → Jobs → New job, the modal estimates the cost up front based on the number of items selected, the rough token count per item for the chosen prompt, and the connection model’s pricing. The estimate is an order-of-magnitude figure — actual cost depends on the length of each product’s description — but it is usually within ±30 % of the real total for catalogues larger than a few hundred items.

Two ways to keep costs in check:

  • Pilot first — run a job over 50 items, look at the real cost, multiply.
  • Set per-job filters — the new-job modal supports filters like “only items missing the field” so you don’t pay to regenerate fields you’ve already filled.

Both web_search and image edit calls carry flat per-call fees on top of token costs. A bulk content job with web search on a 10 000 product catalogue can easily exceed the model token cost. The new-job modal surfaces this in the estimate — pay attention to the “non-token cost” line.