Skip to content

Blog

News, analyses, and notes about AI.

Batch API in LLM Providers: Asynchronous Processing of Large Volumes

Cover: Batch API in LLM Providers: Asynchronous Processing of Large Volumes Batch API is a mode where requests to the model are sent not individually but in batches as a job file. The provider processes the batch asynchronously over hours and returns the result in a separate file. Compared to synchronous mode, the discount is usually 40–50%, but the cost is a delay: the response comes not in seconds but in minutes or hours.

Token Counting Before API Call: Accuracy, Tools, and Budgeting

Cover: Token Counting Before API Call: Accuracy, Tools, and Budgeting The cost of a request and the likelihood of a context_length_exceeded error are determined by the number of tokens in the input and output. Estimating them by eye based on characters or words is inaccurate, with discrepancies reaching double. Precise counting before sending is a mandatory step in any production pipeline.

Multi-tenant Isolation in LLM API: Keys, Quotas, Data, and Prompts

Cover: Multi-tenant Isolation in LLM API: Keys, Quotas, Data, and Prompts When a single LLM API serves multiple tenants—clients, teams, or projects—risks arise: data leakage between tenants, resource exhaustion by one consumer, context contamination in prompts, and exposure of system instructions. Isolation addresses these issues at the level of keys, quotas, storage, and prompts. Below is a practical schema that I apply in production.

Invalidating Prompt Cache in LLM API: Avoiding Outdated Responses

Cover: Invalidating Prompt Cache in LLM API: Avoiding Outdated Responses Caching prompts reduces the cost and latency of LLM API, but it introduces the risk of serving outdated responses. The issue arises when the system prompt, model version, knowledge base content, or business logic rules change, yet the cache continues to return results based on the previous configuration. In this article, I discuss a practical scheme for invalidation: how to build cache keys, what fields to include in the version, how to tag records, and how to organize cascading resets.

Monitoring Context Window: Metrics and Alerts

Cover: Monitoring Context Window: Metrics and Alerts The context window is the most expensive resource in an LLM API. When it overflows, the model starts to 'forget' the beginning of the dialogue, the quality of responses drops, and costs rise. Below is how to build a context window monitoring system that warns about problems before they become critical.

LLM API Security: Key Protection and Injection Prevention

Cover: LLM API Security: Key Protection and Injection Prevention

Security often takes a backseat when working with LLM APIs: first, the model needs to respond, then faster and cheaper. But when the system goes to production, security questions become critical. Below are the main threats and practical security measures for LLM APIs: from key storage to protection against prompt injection and data leaks.