Learn about artificial intelligence (AI)
Language models, RAG and agents now power bots and apps. Understand the concepts, the costs and how to host AI applications.
Featured
- CostsHow much does an AI chatbot cost to build and run?Running an AI chatbot costs model tokens, hosting, a database and, with RAG, extra context per message. See how to estimate the cost per conversation.
- CostsHow much does a RAG system cost? Embeddings, database and LLMA RAG system has three costs: embeddings, a vector database and the LLM. See the math for 1,000 questions a day, with hypothetical prices, and where the bill grows.
- How-to guidesHow to build a Discord AI botBuild a Discord AI bot with discord.js: an /ask command, the API key in an environment variable, per-channel memory, Discord limits and how to host it.
Concepts8
- What are embeddings and what are they used for?An embedding is a vector of numbers that represents the meaning of a text. Learn how cosine similarity works, what dimensions change and how search and RAG use it.
- What is an AI agent (and how it differs from a chatbot)?An AI agent is a language model that picks, in a loop, which tools to use until it reaches a goal. Learn how it works, how it differs from a chatbot and the risks.
- What is an OpenAI-compatible API?An OpenAI-compatible API accepts the same request and response format as OpenAI's: change the base URL, key and model and keep the same SDK. See what still varies.
- What is a vector database?A vector database stores embeddings (lists of numbers) and finds the items closest in meaning, not just in keywords. Learn how it works and when to use one.
- What is MCP (Model Context Protocol)?MCP is an open protocol that connects AI applications to external tools and data. See how it works, its parts, its transports, and a minimal server.
- What is prompt injection?Prompt injection is when untrusted text changes how an LLM behaves. Learn direct vs indirect attacks, real examples, and how to limit the damage in AI apps and bots.
- What is a large language model (LLM)?An LLM is an AI model trained on huge amounts of text to predict the next token. See how it works, what a context window is, why it hallucinates and when to use one.
- What is RAG?RAG (retrieval-augmented generation) finds relevant passages in your own data and gives them to an LLM with the question. Learn how it works and when to use it.
How-to guides9
- How to use an AI agent to fix deploy errorsTo fix a failed deploy with AI, give the agent the full log, the start command and your dependencies, ask for the cause before the fix and review every change.
- How to connect Claude, Cursor or VS Code to your server over MCPTo connect an AI client to a remote MCP server, add its URL, authorize with OAuth or an API key and check the exposed tools. Steps for Claude, Cursor and VS Code.
- How to build a RAG chatbot with PostgreSQL and pgvectorBuild a RAG chatbot with PostgreSQL and pgvector: chunk your documents, create embeddings and an HNSW index, search by distance and answer with sources.
- How to give a chatbot memory: history, summaries and RedisChat APIs keep nothing between calls, so memory is your app's job. Learn the history window, rolling summaries, Redis with a TTL and long-term memory.
- How to build a Discord AI botBuild a Discord AI bot with discord.js: an /ask command, the API key in an environment variable, per-channel memory, Discord limits and how to host it.
- How to host an AI chatbotAn AI chatbot is an API that takes messages, calls a language model and streams the reply back. Here is the code and how to put it online.
- How to host n8nHosting n8n means running its server on an always-on process with a public HTTPS URL, a database and a fixed encryption key. Here is the step by step.
- WhatsApp AI bot: architecture and costsA WhatsApp AI bot is a webhook that receives the message from the Cloud API, calls an LLM and replies. See the architecture, the FastAPI code and what it costs.
- Streaming AI responses to users (SSE)Stream LLM output to the browser with server-sent events: a Node.js endpoint, a fetch client that parses the stream, and fixes for buffering and dropped connections.
Problems and errors3
- 429 errors from an AI API: rate limits, quota and how to handle themA 429 from OpenAI, Claude or Gemini means a rate limit or exhausted quota. Learn to tell them apart, read the limit headers and retry with backoff.
- context_length_exceeded: when the conversation no longer fits the context windowcontext_length_exceeded means prompt, history, tools and output went past the model's context window. Learn how to count tokens and fix it for good.
- Why your chatbot makes things up (hallucination) and how to reduce itA hallucination is an LLM stating something false with confidence. Learn why chatbots make things up and what reduces it: RAG, citations and validation.
Costs4
- How much does an AI chatbot cost to build and run?Running an AI chatbot costs model tokens, hosting, a database and, with RAG, extra context per message. See how to estimate the cost per conversation.
- How much does a RAG system cost? Embeddings, database and LLMA RAG system has three costs: embeddings, a vector database and the LLM. See the math for 1,000 questions a day, with hypothetical prices, and where the bill grows.
- How to cut LLM token costs: prompt caching, smaller models and limitsTo cut LLM token costs, use prompt caching, a smaller model for simple tasks, output limits, history summaries and batch. See each technique with the math.
- How much does an LLM API cost for your app?An LLM API bills per token, and output costs more than input. See a worked monthly estimate for a bot and practical ways to cut the bill.
Comparisons4
- RAG vs fine-tuning: which to useRAG puts your data in the prompt at question time; fine-tuning changes the model's weights with examples. Compare cost, updates, latency and when to use each.
- pgvector vs a dedicated vector database: which to usepgvector stores vectors in PostgreSQL, next to your data; a dedicated vector database focuses on scale and filtering. Compare indexes, operations and migration.
- Local LLM (Ollama) vs an API: cost, hardware and privacyRunning a local LLM with Ollama trades per-token cost for hardware and upkeep; an API gives you bigger models with no server. Compare RAM, cost and privacy.
- MCP vs function calling: differences and when to use eachFunction calling declares tools in every request and your code runs them; MCP is a protocol that serves tools to any client. Compare them and see when to use each.
Which to choose3
- Which AI model to choose for your chatbotPick your chatbot's model by quality on your own questions, latency, price per token, context, tool calling, language and privacy. See how to test candidates.
- LangChain, LlamaIndex, AI SDK or the provider SDK: which to useCompare LangChain, LlamaIndex, the Vercel AI SDK and the provider's own SDK: what each one solves, the same flow in code and which to use in each scenario.
- Best way to host an AI agentAn AI agent runs a tool calling loop that can last minutes. Compare serverless, an always-on container, a VPS and a queue with a worker, and see which to use.