Python basic with Poetry¶
Smallest SDK example
This is the smallest runnable LunarGate example. It is intentionally very close to the homepage snippet, but turned into a real project with `.env`, a real `main.py`, and a gateway config you can run locally.
Use this example when:
- you already know the OpenAI Python SDK
- you want the smallest possible diff from direct OpenAI usage
- you do not need streaming, UI, or multi-container orchestration yet
What it demonstrates¶
OpenAI(base_url=...)pointed at the gateway- one
chat.completions.create(...)request .env-driven local configuration- a minimal single-provider gateway config
Run it¶
Start the gateway in a separate terminal:
Then run the client:
What to inspect¶
.env.examplefor client-side defaultsconfig-simple.yaml.examplefor the smallest working gateway configmain.pyfor the minimal OpenAI SDK integration
Why this example matters¶
This is the shortest path from:
- direct OpenAI client usage
To:
- the same SDK talking to LunarGate instead
If you already have a Python service and do not need streaming, UI, or multi-container orchestration yet, this is the right place to start.
Next step after this example¶
- Move to Docker Compose minimal if you want the gateway and app in one local demo.
- Move to Python
lunargate/autodemo if you want the gateway to choose model tiers for you.