OpenAI Python SDK
Drop-in optimization for the official OpenAI Python library
Add Promptly to any OpenAI Python SDK project in 2 lines. Change base_url and api_key - everything else stays the same.
Setup Guide
Install the SDK
Use the standard OpenAI Python package. No extra dependencies needed.
pip install openaiChange Two Lines
That's it. Two lines changed: api_key and base_url. All OpenAI features - streaming, function calling, structured output, vision - work perfectly.
from openai import OpenAI
# Before
# client = OpenAI(api_key="sk-...")
# After - just add base_url
client = OpenAI(
api_key="sk-promptly-...",
base_url="https://api.getpromptly.in/v1",
)
# Everything else is identical
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)Why Use Promptly with OpenAI Python SDK?
- 2-line integration - change api_key and base_url
- 100% compatible with OpenAI SDK features
- Streaming, function calling, vision all supported
- Automatic optimization on every call
- Roll back to direct OpenAI in seconds
Start optimizing OpenAI Python SDK costs
Sign up, grab your API key, and change your base URL. Under 2 minutes.
Other Integrations
Promptly Python SDK
Official Python SDK - the fastest way to get started
Promptly Node.js SDK
Official Node.js SDK - TypeScript-first, zero config
LangChain
Use Promptly as your LLM backend in LangChain
Vercel AI SDK
Optimize AI SDK streaming responses with Promptly
LlamaIndex
Optimize your RAG pipeline costs with Promptly