n4nAI

Topic

Python Raw REST Calls (requests/httpx)

13 posts on python raw rest calls (requests/httpx) — part of api integration on the n4n AI blog.

API integrationGuide

Timeout and connection error handling for LLM REST calls

Practical guide to python timeout error handling llm rest api: set explicit timeouts, catch connection errors, retry with backoff, and avoid common pitfalls.

3 min read
API integrationComparison

Python requests vs the OpenAI SDK: raw REST tradeoffs

A pragmatic engineer's comparison of python requests vs openai sdk for LLM API calls: capabilities, latency, cost, ergonomics, and which to use when building.

4 min read
API integrationHow-to

Python requests session pooling for high-volume LLM calls

Learn python requests session pooling llm techniques to reuse TCP connections and reduce tail latency at high call volumes with code.

3 min read
API integrationComparison

Python httpx vs requests for calling LLM APIs

A pragmatic head-to-head comparison of python httpx vs requests llm API calls across capabilities, latency, ergonomics, and verdicts for engineers.

4 min read
API integrationHow-to

How to send image and text requests to vision LLMs in Python

Step-by-step guide to sending image and text prompts to vision LLMs in Python using raw requests and httpx, with OpenAI-compatible payloads and verification.

2 min read
API integrationTutorial

How to parse streaming JSON chunks from an LLM API in Python

Learn how to python parse streaming json llm responses in Python using httpx: buffer SSE chunks, split lines, and decode JSON deltas safely.

2 min read
API integrationHow-to

How to call GPT-4o via REST API using Python requests

Step-by-step guide to calling GPT-4o via REST API using Python requests, from API key setup to parsing streaming responses and handling errors.

3 min read
API integrationGuide

Handling server-sent events from LLM APIs in Python

Learn how to handle python server-sent events llm api responses in Python with httpx and requests, including SSE parsing, retries, and streaming pitfalls.

4 min read
API integrationTutorial

Building a retry-with-backoff wrapper for LLM REST calls

Build a robust python retry backoff llm rest api client with httpx. Hands-on tutorial covering exponential backoff, jitter, and flaky mock testing.

2 min read
API integrationTutorial

Building a minimal Python LLM client with httpx

Build a python minimal llm client httpx from scratch with auth, streaming, retries, and OpenAI-compatible calls in this hands-on tutorial for engineers.

3 min read
API integrationTutorial

Streaming LLM responses in Python with httpx and SSE

Stream LLM responses in Python with httpx and SSE. Build a minimal OpenAI-compatible client: sync/async code, error handling, retries, and production checklist.

3 min read
API integrationHow-to

Calling the n4n.ai REST API from Python with requests

Learn how to call the n4n.ai LLM REST API from Python using requests, with runnable code for auth, chat completions, streaming, and error handling.

3 min read
API integrationHow-to

Async LLM API calls in Python with httpx.AsyncClient

Learn to build concurrent, resilient LLM API calls in Python using httpx.AsyncClient with retries, streaming, routing, and usage metering.

3 min read