🐍

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

1

Install the SDK

Use the standard OpenAI Python package. No extra dependencies needed.

bash
pip install openai
2

Change Two Lines

That's it. Two lines changed: api_key and base_url. All OpenAI features - streaming, function calling, structured output, vision - work perfectly.

python
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.