Buy Fermi credits with your saved card
buy_creditsCharges the user's saved payment card to buy Fermi credits, or, if no card is saved yet, returns a checkout link instead and charges nothing. Use this when the user asks to buy or top up Fermi credits, including before the dollar amount is named and while the user is not signed in. Never call it on your own initiative.
The user's authorization: before the call, tell the user the number of credits and the dollar charge (credits times $0.50; for example 10 credits is $5.00). The user's yes to that, or a request that already names both the credits and the dollar amount, authorizes that one call: make it then, without asking again, and make it again after a sign-in. It does not authorize a second purchase. A request that names only the credits ("buy 10 credits") is still a request for this tool: state the dollar charge, and make the call on the user's yes. A call refused because the user is not signed in charges nothing, so the call made again after the sign-in is still that one purchase.
Returns credits_purchased, new_balance and payment_status after a charge. With no saved card, the first call charges nothing: it returns a checkout_url where the user saves a card in a browser, so that call needs no separate warning about a charge. Then call this again.
One call can buy at most 100 credits; a larger request is refused and nothing is charged.
Credits pay for estimates on an account (see estimate_quantity_or_probability for tier costs). To see the balance first, use check_account_and_credits. When the user is not signed in, call the tool as normal. If the user's app supports sign-in, it will ask the user to sign in, and you can call the tool again after that. Do not send the user to their connector or app settings to sign in first. Only if the user's app cannot sign in (a REST caller, or an agent with no connector), create an account with POST https://fermi.kromatic.com/api/v1/accounts (it returns an api_key once; a new account starts with 3 credits) and pass that key as the api_key argument.
Cost: real money -- charges the saved card $0.50 per credit. Needs an account.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"credits": "<credits>"
},
"name": "buy_credits"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | Your Fermi API key. Omit it if your connector is signed in with permission to buy credits. | |
| credits | Yes | How many credits to buy, 1 to 100. Each is charged to the saved card at the price in this tool's cost line. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| billing | No | Who this call was billed to and what is left. Present on every Fermi result. | |
| new_balance | No | Credit balance after it. | |
| checkout_url | No | No card saved: open this in a browser to save one, then call buy_credits again. | |
| credits_added | No | 0 when a checkout_url is returned instead. | |
| payment_status | No | Card payment status. | |
| credits_purchased | No | Credits bought by this call. |