OPENAI WORKFLOW · 01 / 10

Set up the OpenAI Python SDK

Create an isolated Python environment before making your first API request.

Documentation checked · Loomwell editorial guide · Examples have not been live API tested.

Steps

  1. Create a virtual environment and install the official openai package with the same Python interpreter that will run your application.
  2. Configure OPENAI_API_KEY privately in your server environment. Set OPENAI_MODEL to a model available to your project and compatible with the feature you are testing.

Example

Shell · Python API examples require OPENAI_API_KEY and OPENAI_MODEL in your server environment. API calls may incur OpenAI charges.

python -m venv .venv
source .venv/bin/activate
python -m pip install openai
python -c "from openai import OpenAI; print('SDK import OK')"

Check the result

The import check should print SDK import OK without calling the API. If imports fail, check which Python interpreter your editor uses. Record the installed SDK version in your application dependency lockfile.

Official source

OpenAI developer quickstart

Check current provider documentation and model support before deployment. This guide is separate from the approved evidence records listed in the catalog.

Use Loomwell with your coding agent

Inspect the published record coverage before starting a trial or connecting MCP.