Use your own AI key in Analytics
Connect an OpenAI, Anthropic or OpenRouter key for the Analytics assistant, set a budget, and revoke it.
The Analytics assistant answers questions about your store and words recommendations. It runs on your own provider key: the provider bills you, and PaidGoods charges nothing for AI. Reports, CSV export and MCP reads never need a key.
The numbers always come from PaidGoods. The model only explains them; recommendations and their verdicts come from fixed rules, and wording that changes a number is thrown away.
Your assistant conversations are private to your member account. Other team members, including the owner, and MCP keys cannot open them. They stay until you delete them, leave the store team, lose store access, or the store is deleted. Deletion removes the questions and answers; token and cost usage records remain without question text. Saved analyses are separate and shared with the team.
POST assistant/ask creates a conversation and returns conversationId; send that id with another question for a follow-up. GET assistant/conversations pages newest first; send its opaque nextBefore value as before for the next page. GET assistant/conversations/{id} opens one, and DELETE assistant/conversations/{id} or DELETE assistant/conversations removes one or all of yours. Follow-ups send the newest three completed turns. Each message is limited to 2,000 characters; the answer says when older turns were omitted or messages shortened. Saved answers keep their full text. Deleting history while an answer is running does not restore the deleted text; any provider cost still counts.
Set it up
All routes are under /v1/stores/{storeId}/profitability/. Changing AI settings needs the Edit store settings permission.
- Read what is shared.
GET ai/disclosure?provider=openailists where data goes, what is sent (totals, order economics by order number, ad and product names, your approved profile), what is never sent (customer names, emails, addresses, credentials), the provider's terms and how billing works. - Approve sharing.
POST ai/consentwith the provider and the data categories you agree to. Nothing is sent to a provider before this. - Add the key.
POST ai/keyswithprovider(openai,anthropicoropenrouter),modelandapiKey. The key is stored encrypted; you only ever see a masked hint likesk-…7f3a. Adding a new key replaces the old one. - Check prices. Listed models get starting prices per million tokens. Providers change prices, so correct them with
PUT ai/keys/{id}/pricesif needed. A model without prices can't be used, because the cost couldn't be limited. - Set a budget.
PUT ai/budgetwith a monthly cap, a per-request ceiling, how many requests may run at once, and a stop switch. Also set a limit at the provider: the budget here is an estimate from token counts. - Optional: check the key.
POST ai/keys/{id}/checkcalls the provider's free model list. It sends no store data and uses no tokens.
Ask
POST assistant/ask with { "question": "...", "query": { "from": "...", "to": "..." } }.
- Every request reserves its worst-case cost first. If that would pass the monthly cap, the request is refused before anything is sent.
- The answer cites the period, definitions, sources and completeness it used. When a source is stale, costs are missing, orders are under 30 days old or a sample is under 10 orders, it won't give a firm recommendation and names the next check instead.
- Asking it to change something ("pause the AU ad") gets a refusal. It has no tool for that.
- Save an answer with
POST assistant/saved; download a Markdown handoff withGET saved-analyses/{id}/handoff.md.
GET ai shows the masked key, budget, this month's spend and consents. GET ai/usage lists each request: who asked, which tools and snapshots were used, the reserved and actual cost and the outcome. Prompt and answer text are not kept there.
Your conversations
In Assistant → Chat, every question goes into a conversation that only you can see. Your conversations lists them, newest first: open one to read it or ask a follow-up (the last three answers go with it), start a New conversation, delete one, or Delete all my conversations. Deleting removes the questions and answers; AI budget usage records stay, without the text. Conversations also go when you leave the team, lose access or the store is deleted. Save to analyses shares an answer with the team.
Answers appear when they are complete; there is no word-by-word streaming yet.
If your AI budget is in a currency other than US dollars, type the token prices in that currency and tick the confirmation: providers list prices in dollars.
Revoke
POST ai/keys/{id}/revoke deletes the stored key at once and stops any request that hasn't been sent yet, including the rest of an answer in progress. Requests already sent to the provider can't be recalled. If you think the key leaked, also revoke it at the provider.
If the provider fails or rejects the key, you get an error. PaidGoods never retries with another provider or with its own key.