Calling AI APIs in Node.js: OpenAI SDK and Native Fetch Integration, Streaming, Timeouts, Retries, and Error Handling
Call OpenAI-compatible AI APIs in Node.js 18+: use the official openai SDK by changing baseURL and apiKey, or native fetch with manual SSE parsing, AbortController timeouts, status-code-based retries, and handling of 401, 429, and connection errors.
Python Calling AI API: From Client Initialization and Changing base_url to Streaming Output and Retries
Use the openai Python SDK or httpx to call OpenAI-compatible model endpoints: how to initialize the client, change only base_url to connect to other endpoints, read normal and streaming responses, and handle timeouts, 429, and 5xx retries. Each step includes runnable code.
How to Obtain, Store, and Partition an AI API Key: Integration and Isolation from Local Development to Production
After obtaining an AI API Key, the first step is to decide where it will be stored, and then write the calling code. This article explains how to inject the Key using environment variables and secret management systems, how to integrate by only changing the base_url with an OpenAI-compatible format, how to partition Keys by environment and business, and the order of handling after a Key leak.
How to Read AI API Error Codes: Causes, Retries, and Fallbacks for 400, 401, 404, 429, 5xx, and 529
Explains common LLM API error codes by splitting them into "fix the request" and "wait and retry" categories, focusing on distinguishing 429 rate limits from quota exhaustion, and provides backoff retry, circuit breaker, and fallback patterns to avoid wasted retries and retry storms.
How to Fix AI API Timeouts: Tracing 504, 524, and APITimeoutError Step by Step
Most LLM request timeouts happen because long context and long outputs exceed the default wait times of the client, Nginx, or Cloudflare; this article walks through pinpointing the break point, enabling streaming, setting per-phase timeouts, adjusting proxies, and controlling retries and output length, with Python SDK and Nginx configuration examples and the conditions under which each setting applies.
NexAIX-官方博客