asyncopenai-concurrency-httpx-pool

asyncopenai-concurrency-httpx-pool is a skill for Claude Code from kennethkhoocy/applied-micro-skills. It costs 161 tokens per session (986 once invoked), scanned A, original, MIT.

A guide for increasing the number of simultaneous requests in asynchronous OpenAI SDK programs that score batches of text. It explains how the SDK's HTTP connection pool can limit requests even when the program allows more tasks.

In plain words
What is it for?
Use it when an asyncio pipeline stalls around 100 in-flight requests, including pipelines using AsyncOpenAI or compatible providers such as DeepSeek.
Why use it?
It helps diagnose a silent throughput ceiling where raising the concurrency setting does not make batch processing faster.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument; mentions Claude Code.

Part of the applied-micro plugin — 17 skills shipped together

Good fit Use it when an asyncio pipeline stalls around 100 in-flight requests, including pipelines using AsyncOpenAI or compatible providers such as DeepSeek.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kennethkhoocy/applied-micro-skills/asyncopenai-concurrency-httpx-pool
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kennethkhoocy/applied-micro-skills --skill asyncopenai-concurrency-httpx-pool
Clone the repo
git clone --depth 1 https://github.com/kennethkhoocy/applied-micro-skills

Made for: Claude Code.

Or install applied-micro, the plugin that ships this one along with the rest of its 17 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for asyncopenai-concurrency-httpx-pool

README.md
[![agentmods](https://agentmods.dev/badge/skills/kennethkhoocy/applied-micro-skills/asyncopenai-concurrency-httpx-pool/github.svg)](https://agentmods.dev/skills/kennethkhoocy/applied-micro-skills/asyncopenai-concurrency-httpx-pool)
Your own site
<a href="https://agentmods.dev/skills/kennethkhoocy/applied-micro-skills/asyncopenai-concurrency-httpx-pool"><img src="https://agentmods.dev/badge/skills/kennethkhoocy/applied-micro-skills/asyncopenai-concurrency-httpx-pool/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for asyncopenai-concurrency-httpx-pool

Your own site · 80×15
<a href="https://agentmods.dev/skills/kennethkhoocy/applied-micro-skills/asyncopenai-concurrency-httpx-pool"><img src="https://agentmods.dev/badge/skills/kennethkhoocy/applied-micro-skills/asyncopenai-concurrency-httpx-pool.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 161 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 986 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00161 $0.00986
Opus 5 $0.00081 $0.00493
Sonnet 5 $0.00032 $0.00197
Haiku 4.5 $0.00016 $0.00099

Measured 11d ago against content hash 4559da6d4547, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

asyncopenai-concurrency-httpx-pool scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/applied-micro/skills/asyncopenai-concurrency-httpx-pool/SKILL.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AsyncOpenAI Concurrency: the Hidden httpx Pool Cap

Problem

Async batch scorers typically gate concurrency with asyncio.Semaphore(N). Raising N above ~100 silently does nothing: the OpenAI SDK's default httpx transport caps the connection pool at max_connections=100, so excess tasks queue inside httpx instead of reaching the provider. The semaphore looks like the throttle but is not the binding constraint — there is no error, just a throughput ceiling.

Context / Trigger Conditions

  • asyncio.Semaphore(N) with N > 100 around client.chat.completions.create shows the same throughput as N = 100
  • Client constructed as AsyncOpenAI(api_key=..., base_url=...) with no http_client argument (the default transport)
  • Provider is known to allow high concurrency (DeepSeek v4-flash: ~2500)
  • Symptom check: requests-in-flight measured at the server never exceeds ~100

Solution

Size the httpx pool to the semaphore when constructing the client:

import httpx
from openai import AsyncOpenAI

CONCURRENCY = 2000
client = AsyncOpenAI(
    api_key=..., base_url="https://api.deepseek.com",
    http_client=httpx.AsyncClient(limits=httpx.Limits(
        max_connections=CONCURRENCY,
        max_keepalive_connections=CONCURRENCY)))
sem = asyncio.Semaphore(CONCURRENCY)

Both edits are required; either alone caps the other. Keep the per-request retry loop — at high concurrency transient failures are more likely, and the retry envelope is what turns them into non-events.

Verification

Throughput scales with N. Verified 2026-07-17 on DeepSeek v4-flash (deepseek-chat, JSON-mode unit scoring, ~1.5k-token prompts): at semaphore 50 a cold 13.8k-request chunk took ~70 min; at semaphore 2000 + matched pool, a 14.4k-request chunk took ~11 min (~40 req/s sustained, ~250/s burst on a 1.7k-request tail chunk), 0 failed requests, 0 schema-invalid responses. Effective speedup ~7x rather than 40x — server-side queuing absorbs the rest — but with zero reliability cost.

Read the full file on GitHub · 92 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 92 lines · 161 tokens per session scan A 4559da6d4547

Subscribe to this mod's changes

asyncopenai-concurrency-httpx-pool is a skill published in the GitHub repository kennethkhoocy/applied-micro-skills (28 stars, last pushed 6d ago), licensed MIT. It adds 161 tokens to every session and 986 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

baoyu-danger-gemini-web

Generates images and text via reverse-engineered Gemini Web API. Supports text generation, image generation from prompts, reference images for vision input, and multi-turn conversations. Use when other skills need image generation backend, or when user requests "generate image with Gemini", "Gemini text generation"…

JimLiu/baoyu-skills · 74 tokens

understand-knowledge

Analyze a Karpathy-pattern LLM wiki knowledge base and generate an interactive knowledge graph with entity extraction, implicit relationships, and topic clustering.

Egonex-AI/Understand-Anything · 32 tokens

data-engineering

Builds and operates data pipelines — ingestion, transformation, orchestration, quality testing, and reliability of data delivery. Use this to design or debug a pipeline, decide batch versus streaming, add data quality checks, handle late or duplicate data, or work out why a dashboard's numbers changed without anyone…

cbrock84/headcount · 67 tokens

better-prompt

A prompt editor that turns rough instructions for AI systems into clearer, more complete prompts. It follows published OpenAI and Anthropic guidance.

huangwb8/skills · 107 tokens

custom-post-type-architect

Use when the user asks to create a custom post type, build a portfolio, set up case studies, add team members, events, or podcast episodes, or says 'scaffold a CPT'. Creates the post type plus supporting taxonomies, an ACF field group, sample entries, and a builder-specific single template suggestion.

respira-press/agent-skills-wordpress · 71 tokens

creating-springboot-projects

Use when starting a new Spring Boot 4 project — scaffolding a service, REST API, or modular backend; picking an architecture (layered, package-by-module, modular-monolith, tomato, DDD-hexagonal); selecting Spring Boot 4 features; or applying the bundled templates and references in this skill. Not for migrating…

a-pavithraa/springboot-skills-marketplace · 91 tokens