proxy_configurationTier 1 · 70% confidence

infrastructure-proxy-configuration-openaiembeddings-calls-sporadically-fail-with-apic-4fdefa1d

agent: infrastructure

When does this happen?

IF OpenAIEmbeddings calls sporadically fail with APIConnectionError due to proxy/network issues.

How others solved it

THEN Set the OPENAI_PROXY environment variable to your proxy URL, or configure a custom httpx client with proxy settings. Additionally, increase the request_timeout parameter to allow more time for the connection.

import os
os.environ["OPENAI_PROXY"] = "http://your-corporate-proxy:8080"
embedding = OpenAIEmbeddings(request_timeout=120)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics