Skip to content

AI features

An AI feature lets your product write, summarize or answer questions by itself. Your server sends each request to an AI company’s API, and you pay a little for each one.

Do I need an AI API in my product?

You need one if your product itself should write, summarize, sort or answer in words, like a helper chat or a short summary of a long note.

If you only want AI to help you write the code
Skip it. Your AI tool already does that, with no API and no extra bill.

Words: API, AI coding tool

What’s the fastest way to add AI to my product?

Pick one of the options and follow its steps. You make the account, set a spending limit before your first request and create the key. Your AI tool writes the code, so the key stays on your server.

If you have done this before
Put the key in .env, then copy the prompt into your AI tool.
Prompt: AI features
I want to add one AI feature to my product, using an AI company’s API.
First ask me which one I chose (the Claude API, the OpenAI API or the Gemini API) and what the feature should do.

Before you write code:
- Check that .env is listed in .gitignore. If it isn’t, add it. Don’t open or print .env.
- Check the AI company’s current official docs for the right library and a current, low-cost model.

Then build the feature:
- Call the API only from server code, like an API route or a server function. Never from the browser or a phone app.
- Read the key from an environment variable. Never put it in code, logs or Git.
- Cap how long the answer can be, and limit how often one person can use the feature.
- Show a friendly message when the service is busy, a limit is reached or credits run out.

Ask me before you install anything, sign in to anything or spend money. Never ask me to paste a key into this chat.

This comes from https://buildladder.com/concepts/ai-features#fastest-way. If you can open web pages, read https://buildladder.com/concepts/ai-features.md for the current version. BuildLadder guide, tool, concept, answer and setup pages all work this way: add .md to the address.

Words: Spending limit, Environment variable

Claude, OpenAI or Gemini: which AI API fits my product?

It comes down to how you start paying and how you cap spending. All three write answers in text and are called from your server.

If you already pay for Claude or ChatGPT
That plan is a separate bill from the API, so it doesn’t pay for your product’s requests. Some bigger plans include a monthly API credit you can claim.
QuestionClaude APIOpenAI APIGemini API
How you start payingYou buy credits first. New users get a small amount of free credits to test with.You buy credits first. The smallest purchase is $5.Free tier first. For more, you set up billing. You may be asked to prepay at least $5.
How to cap spendingSet a monthly spending limit on the Billing page. Keep auto-reload off.Set a monthly spending limit with Enforce a hard limit turned on. Auto-reload starts on, so turn it off.Set a Monthly spend cap on the Spend page. It’s experimental.
When you reach your limitRequests fail with a 400 error until you raise the limit or the next month starts.Requests fail with a 429 error. Spend can go slightly over before they stop.Requests stop, but spend can go over during a delay of about 10 minutes.
The key’s name in .envANTHROPIC_API_KEYOPENAI_API_KEYGEMINI_API_KEY

Swipe the table sideways to see every column.

Words: Credits, Auto-reload

Should I add AI features now or later?

Add it now if AI is the main thing your product does, like a writing helper. Add it later if it’s an extra, like a summary button, and put the basic version online first.

If anyone could use the feature without signing in
Add sign-in and a limit on uses per person. Sign-in alone does not stop bots, and the limit caps what one account can spend.

How much do AI features cost?

From $0.10 per million tokens going in and $0.50 per million coming out, on a small model. Tokens are small pieces of text, and you pay for them on every request.

If you want to know what one use costs
Try the feature five times. Open the service’s usage page, divide the added cost by five, and write that average cost into PLAN.md.
If one use costs more than you expected
Ask your AI tool for a smaller model and shorter answers. A small model costs a fraction of a big one.
QuestionClaude APIOpenAI APIGemini API
A small, fast modelClaude Haiku 5.5: $0.10 per million tokens in and $0.50 out, for prompts up to 100,000 tokens.GPT-6 Luna: $0.10 per million tokens in and $0.50 out.Gemini 3.5 Flash-Lite: free on the free tier, with limits. On the paid tier, $0.30 per million tokens in and $2.50 out.
A bigger modelClaude Sonnet 5.5: $2 per million tokens in and $10 out.GPT-6.1 Sol: $2 per million tokens in and $10 out.Gemini 4 Argon, paid tier only: $2 per million tokens in and $10 out through November 30, 2026. From December 1, $4 and $20.

Swipe the table sideways to see every column.

Words: Token, AI model

What changes about AI features when my product grows?

More people means more requests, so you reach rate limits and your spending limit sooner. Raise your spending limit when you’re ready. Each AI company also sets its own monthly maximum for your account.

If real people hit a rate limit
Show a friendly wait message and try again shortly. Claude raises an account’s limits as it builds a history of use.
If you get close to the AI company’s monthly maximum
Claude’s Start tier caps spending at $500 a month, and Gemini’s Tier 1 at $250. Ask for a higher tier before you need it.
If your free Gemini testing turns into real use
Set up billing before real people use it. On the paid tier, Google doesn’t use your requests to improve its products.

Words: Rate limit

How does an AI API work underneath?

Your server sends text to the AI company’s computers, with your secret key attached. The model writes an answer and sends it back.

If the key sat in the browser or a phone app
Anyone using your product could read it and spend your credits. All three AI companies say to call the API from your own server.
If a key leaks, for example into GitHub or a chat
Delete it on the AI company’s API keys page and make a new one. Then update .env and your host’s settings.
If an answer takes a few seconds
That’s normal for longer answers. Show a loading message while the model works.

Words: API key, Server

Questions people ask

Updated Sources: Firebase: sign-in and protection from automated abuse, Claude API pricing, Claude API spend and rate limits, Claude: paying for API usage, Claude API authentication, OpenAI API pricing, OpenAI spend limits, OpenAI: prepaid API billing, OpenAI: API key safety, Gemini API pricing, Gemini API billing and spend caps, Gemini API keys, Stack Overflow Developer Survey 2025: Technology, npm downloads, Oct 10 to Nov 8, 2026: @anthropic-ai/sdk, npm downloads, Oct 10 to Nov 8, 2026: openai, npm downloads, Oct 10 to Nov 8, 2026: @google/genai, npm downloads, Oct 10 to Nov 8, 2026: @mistralai/mistralai.