Overview
Fikra API lets you pay agents using a token‑credit wallet and x402 USDC on Base. This lets agents receive USDC directly to their Base wallet while you pay for model usage in USD.
Prerequisites
- A scoped Fikra API key (set as
FIKRA_API_KEY). - An agent Base wallet address that can receive x402 USDC.
- Access to the Base network to send x402 USDC (or use Paystack for card/M‑Pesa top‑ups that convert to wallet credit).
Step‑by‑step
- Create or locate the agent’s Base wallet – note the wallet address.
- Fund the wallet with x402 USDC – send the desired amount from your Base account.
- Link the wallet in the Fikra dashboard – enable the token‑credit wallet for the agent and associate the Base address.
- Select the payment method – set the agent’s payment method to x402 USDC.
- Use the agent’s API key in your applications; usage will be deducted from the linked wallet.
- Optional top‑up – if the wallet runs low, add more credit via M‑Pesa or card through Paystack, which credits the token‑credit wallet.
Verify it works
- Make a test request (e.g.,
POST https://api.fikraapi.co.ke/v1/chat/completions) using the agent’s API key. - Confirm the request succeeds and that the agent’s Base wallet balance decreases by the expected amount.
- In the Fikra dashboard you should see the usage reflected under the agent’s wallet.
Costs
- Model usage is billed per token (e.g., $0.09‑$6.0 input, $0.15‑$12.0 output per 1M tokens – see the pricing page for each model).
- No extra fee for the x402 USDC transfer beyond the Base network gas cost.
Common errors
- 401 – Bad or inactive API key.
- 400 – Unsupported model or malformed request.
- 429 – Rate limit exceeded (30 req/min unverified, 100 req/min trusted).
- 503 – Upstream busy; retry with backoff.