Bring your own AI key and track usage
Add your AI provider key on the AI keys page, test the connection, and read the Usage page to see what your agents cost.
Agents need an AI provider to think. For most accounts, you provide your own key. PGB's shared AI capacity is not generally open: unless your account has been given an allowance, a run without your own key stops with "Add your own AI provider key to use this feature."
Add a key
- Get an API key from your AI provider's website. Create one just for PGB so you can revoke it independently.
- In Agents, open AI keys.
- Under Add a key, pick the Provider from the list.
- Paste the Key.
- Choose Check and save.
The key is verified with a small test call that does not use up tokens. A key the provider rejects is not saved. After saving, it is stored encrypted and only the last four characters are ever shown, like ••••a1b2.
Test the connection
Choose Test connection at the top of the page. A green message, "Test passed: your agents can reach a model.", means runs can start. A red message tells you what to fix.
Remove or replace a key
Under Your keys, choose Remove next to a provider and confirm. Agents using it stop until you add another. To replace one, add a new key for the same provider.
Who pays
Your provider bills you directly for the tokens your agents use. PGB does not add a charge for runs made with your own key. Spend is still limited by each agent's budget. See Set budgets and know when a run will stop.
The same key is used by PGB Studio's AI builder, because it belongs to your account.
Read the Usage page
Open Usage. Pick Last 7 days, Last 30 days or Last 90 days.
- Four totals: Runs, Tokens in, Tokens out and Cost.
- Cost per day: a bar chart. Hover a bar for the date, cost and number of runs.
- A table per agent with runs, tokens, cost and This month / budget.
Good to know
- Cost on this page is an estimate from token counts and a price list. Your provider's invoice is authoritative.
- If you see a message saying you have reached your AI usage limit, try again later.
- Never share your key in instructions, chat or support requests.
More guides in PGB Agents
What a PGB Agent is and what it can do
An agent is a saved job with instructions, a list of allowed tools, a budget and a record of every step it takes.
Create an agent from scratch or from the Marketplace
Make a blank agent in two clicks, or add a ready-made one from PGB Marketplace and review it before it runs.
Write good instructions for an agent
How to word the Instructions box so an agent does the right job, stays inside its limits and tells you when it is unsure.
Choose tools and understand which need approval
The list of tools an agent can use, what each does, and which ones always pause for your approval.
Start agents manually, on a schedule or from a webhook
Run an agent by hand, set it to repeat with the schedule builder, or give it a private web address that starts a run.
Set budgets and know when a run will stop
Put a dollar limit on each run and each month, and learn the other limits that stop an agent from running away.