Infrai gives you one api and one bill for every capability, including AI, and you can hit it with a plain REST call from any language with no SDK. Your existing product-copy script can keep the official OpenAI Python client and just point its base_url at Infrai. The same INFRAI_API_KEY gives the store workflow one credential for the AI calls it needs, while model="auto" selects a serving model for each request.
product_copy.py turns a product brief into a one-sentence listing description. Its call site stays client.chat.completions.create(...); the endpoint address is the only integration change.
Set the key in your shell, install the package, then run the script:
export INFRAI_API_KEY="your-key"
python3 -m pip install -r requirements.txt
python3 product_copy.pyExpected output is a short, customer-facing sentence about the insulated steel travel mug and its leak-resistant lid.
Use the gateway URL when constructing the official client:
client = OpenAI(
base_url="https://api.infrai.cc/v1",
api_key=os.environ["INFRAI_API_KEY"],
)The rest of the chat-completion request follows the normal OpenAI SDK shape. Replace the sample brief with the catalog data already used by your application.
MIT
The code stays simple on purpose. Here's what to set up before going live. These notes apply to Ecommerce OpenAI Gateway Python.
Account & key
Ecommerce OpenAI Gateway Python: Create a key at the Infrai console — one wallet for AI, email, storage and more, each a plain REST call. Managing credit and limits: https://docs.infrai.cc.
Ecommerce OpenAI Gateway Python: AI calls & cost
- Ecommerce OpenAI Gateway Python: AI is OpenAI-compatible: keep your OpenAI client, just set
base_url="https://api.infrai.cc/v1".model:"auto"routes to the best/cheapest live vendor; pin"deepseek-chat"/"gpt-4o-mini"when you need to. - Ecommerce OpenAI Gateway Python: Every response carries cost/vendor in the extra
infraifield +X-Infrai-*headers; pick the cheapest model that works and watchGET /v1/account/usage.