Obiguard allows you to make text-to-image requests using the OpenAI-compatible API signature.
Copy
from obiguard import Obiguardclient = Obiguard( provider='openai', base_url='https://gateway.obiguard.ai/v1', obiguard_api_key='vk-obg***', # Your Obiguard virtual key here)response = client.images.generate( prompt="A beautiful sunset over the mountains", n=1, size="1024x1024")
Copy
from obiguard import Obiguardclient = Obiguard( provider='openai', base_url='https://gateway.obiguard.ai/v1', obiguard_api_key='vk-obg***', # Your Obiguard virtual key here)response = client.images.generate( prompt="A beautiful sunset over the mountains", n=1, size="1024x1024")
Copy
from openai import OpenAIfrom obiguard import createHeadersclient = OpenAI( base_url='https://gateway.obiguard.ai/v1', api_key='sk-***', # Your OpenAI API key here default_headers=createHeaders( provider="openai", api_key="vk-obg***", # Your Obiguard virtual key here ))response = client.images.generate( prompt="A beautiful sunset over the mountains", n=1, size="1024x1024")
Copy
curl "https://gateway.obiguard.ai/v1/images/generations" \-H "Content-Type: application/json" \-H "x-obiguard-api-key: $OBIGUARD_VIRTUAL_KEY" \-d '{ "model": "dall-e-3", "prompt": "Lucy in the sky with diamonds"}'