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 Pass Thinking History in Multi-Turn Conversations with OpenAI SDK Compatibility? Tool Call Checklist
In OpenAI SDK-compatible mode, multi-turn conversations and tool calls must return the assistant message's content, reasoning_content, and tool_calls verbatim, with tool_call_id strictly paired with tool_calls[].id; omitting any of these can cause errors or abnormal behavior.
NexAIX-官方博客