docs image edits

This commit is contained in:
Ishaan Jaff
2025-05-24 19:46:10 -07:00
parent 7fae80b4c6
commit 95b59cbf4d
+8 -30
View File
@@ -106,13 +106,6 @@ for i, image_data in enumerate(response.data):
### LiteLLM Proxy with OpenAI SDK
First, set up and start your LiteLLM proxy server.
```bash showLineNumbers title="Start LiteLLM Proxy Server"
litellm --config /path/to/config.yaml
# RUNNING on http://0.0.0.0:4000
```
<Tabs>
<TabItem value="openai" label="OpenAI">
@@ -126,6 +119,14 @@ model_list:
api_key: os.environ/OPENAI_API_KEY
```
Start the LiteLLM proxy server:
```bash showLineNumbers title="Start LiteLLM Proxy Server"
litellm --config /path/to/config.yaml
# RUNNING on http://0.0.0.0:4000
```
#### Basic Image Edit via Proxy
```python showLineNumbers title="OpenAI Proxy Image Edit"
from openai import OpenAI
@@ -148,29 +149,6 @@ response = client.images.edit(
print(response)
```
#### Image Edit with Mask via Proxy
```python showLineNumbers title="OpenAI Proxy Image Edit with Mask"
from openai import OpenAI
# Initialize client with your proxy URL
client = OpenAI(
base_url="http://localhost:4000", # Your proxy URL
api_key="your-api-key" # Your proxy API key
)
# Edit an image with a mask
response = client.images.edit(
model="gpt-image-1",
image=open("original_image.png", "rb"),
mask=open("mask_image.png", "rb"),
prompt="Replace the background with a mountain landscape",
n=2,
size="512x512"
)
print(response)
```
#### cURL Example
```bash showLineNumbers title="cURL Image Edit Request"
curl -X POST "http://localhost:4000/v1/images/edits" \