工程指南 · AI 成本与架构实战

AI 开发者实战指南

深入拆解 Token 计费规则、API 成本优化、提示词缓存收益、自建显卡显存测算与结构化输出规范。

Tokens & Pricing约 6 分钟阅读

LLM Tokens & API Pricing Explained

How BPE tokenization, input vs. output multipliers, 1M+ context windows, and prompt caching actually determine your monthly LLM API bill.

  • 1,000 English words roughly equals 1,300–1,350 BPE tokens, while JSON, TypeScript, and non-Latin text consume significantly more tokens per character.
  • Output tokens typically cost 3x to 5x more than input tokens, and hidden reasoning tokens count as output tokens on reasoning models.
Export & Formatting约 5 分钟阅读

How to Export ChatGPT & Claude Chats to Clean PDF or Markdown

A practical workflow for turning long ChatGPT, Claude, and Gemini conversations into clean, printable PDFs and Obsidian-ready Markdown without broken code blocks.

  • Browser 'Print Page' on chatgpt.com or claude.ai breaks sticky sidebars, clips long code blocks, and wastes margins.
  • Pasting chat threads or importing ChatGPT's conversations.json into a client-side formatter preserves headings, tables, and syntax blocks.
Free AI APIs约 7 分钟阅读

Best Free AI APIs for Developers (Rate Limits & Caveats)

An engineering breakdown of the best zero-cost LLM API tiers in late 2026—covering Google AI Studio, Groq, OpenRouter, Cerebras, Cloudflare Workers AI, and GitHub Models.

  • Google AI Studio, Groq, Cerebras, and OpenRouter all offer genuine zero-dollar developer API keys with no credit card required to start.
  • Every free tier enforces strict requests-per-minute (RPM) and tokens-per-day (TPD) ceilings—never ship a public user-facing app on a single free key without backoff or fallback.
Prompt Engineering约 6 分钟阅读

System Prompt Engineering Playbook for Reliable AI Agents

How to structure system instructions using XML delimiters, explicit failure modes, tool-use guardrails, and deterministic JSON schemas.

  • Separate persona, rules, context, and output format into explicit XML tags or Markdown sections to prevent instruction drift.
  • State negative constraints positively and define explicit fallback behavior when context is missing.
Diagrams & Dev约 6 分钟阅读

MCP Servers Setup Guide for Claude Desktop & Cursor

Step-by-step guide to configuring mcp.json for Claude Desktop, Cursor, and Windsurf—including npx flags, environment variables, and debugging common stdio errors.

  • Claude Desktop reads `claude_desktop_config.json`, while Cursor reads `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global).
  • GUI apps on macOS and Windows often lack your shell PATH—use `npx -y` or absolute binary paths when servers fail to spawn.
Open-Source & Local AI约 6 分钟阅读

How to Calculate VRAM for Local LLMs (Weights, GGUF & KV Cache)

Learn the exact memory math behind running Llama 4, Qwen4, and DeepSeek V4 locally—covering quantization bits, KV-cache growth at long context, and Apple Silicon unified memory.

  • Model weights in VRAM equal `(Parameters_B × Bits_Per_Weight) / 8` GB, plus ~15–20% overhead for KV cache and CUDA/Metal buffers.
  • 4-bit quantization (Q4_K_M / AWQ) cuts a 70B model from ~140 GB (FP16) down to ~42 GB of weights—fitting onto dual 24 GB GPUs or a 64 GB Mac.