Spending your credit
Spending your credit
Your pressed USDC goes to an inference wallet that is yours alone. When you call the OpenAI-compatible endpoint, the cost comes out of that wallet. No one else's balance is involved.
See what you have
GET https://api.berryfi.net/api/creators/{address}/balance
-> { "credited6dp": "...", "spent6dp": "...", "remaining6dp": "..." }Amounts are USDC with 6 decimals and match your inference wallet. For the full history of credits, call GET /api/creators/{address}/inference.
Sign in with your wallet
You never get an API key. To show the address belongs to you, sign this message:
berry-inference:{your_address_lowercase}:{timestamp_ms}A signature works for 5 minutes. Every request carries three headers:
x-berry-address: 0xYourAddress
x-berry-timestamp: 1234567890123
x-berry-sig: 0xSignatureMake a request
curl -X POST https://api.berryfi.net/api/inference/chat \
-H "x-berry-address: 0xYourAddress" \
-H "x-berry-timestamp: TS" \
-H "x-berry-sig: 0xSig" \
-H "Content-Type: application/json" \
-d '{"model":"llama-3.3-70b-instruct","messages":[{"role":"user","content":"hello"}]}'Send the same JSON you would send to OpenAI's chat completions. Every reply also carries a billing section: roughly what the call cost, and how much balance you have left. A 402 status means the balance has run out.
Berry charges a cautious estimate first, then checks it against what the provider actually billed. If you were charged too much, the difference is returned to your balance.