We don’t ship an official SDK. Call us over plain HTTP/HTTPS using the OpenAI-style protocol.
If you already use OpenAI’s official/community SDKs, you can usually just point base_url to our gateway and swap the api_key to your Console key. (Those SDKs aren’t maintained by us.)
1) Setup
Base URL: https://<your-gateway>/v1
API Key: Create in the Console; send via header Authorization: Bearer <key>
model: e.g., gpt-4.1-mini, gpt-4o, DeepSeek-V3 (see Model Catalog & Pricing)
import os, time, requests
BASE = os.environ["ANYINT_API_BASE"]
API_KEY = os.environ["ANYINT_API_KEY"]
prompt = """
A close up of two people staring at a cryptic drawing on a wall, torchlight flickering.
A man murmurs, "This must be it. That's the secret code."
The woman looks at him and whispers excitedly, "What did you find?"
"""
# Step 1 — Create a video generation job
create_resp = requests.post(
f"{BASE}/videos/generations",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"model": "veo-3.1-generate-preview",
"prompt": prompt,
# Optional parameters (may vary by model):
# "duration_seconds": 6,
# "aspect_ratio": "16:9",
# "resolution": "1080p",
},
timeout=60,
)
create_resp.raise_for_status()
operation = create_resp.json()
operation_id = operation["id"]
print("Created video generation job:", operation_id)
# Step 2 — Poll until the job is done
while True:
status_resp = requests.get(
f"{BASE}/videos/operations/{operation_id}",
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=60,
)
status_resp.raise_for_status()
op = status_resp.json()
status = op.get("status")
print("Current status:", status)
if status == "succeeded":
# Assume the first generated video is what we want
video_url = op["result"]["videos"][0]["url"]
break
if status == "failed":
raise RuntimeError(f"Video generation failed: {op.get('error')}")
time.sleep(10)
print("Video ready at:", video_url)
# Step 3 — Download the generated video file
video_resp = requests.get(video_url, timeout=300)
video_resp.raise_for_status()
with open("dialogue_example.mp4", "wb") as f:
f.write(video_resp.content)
print("Generated video saved to dialogue_example.mp4")
# Start a long-running video generation job
operation_id=$(
curl -s "${ANYINT_API_BASE}/videos/generations" \
-H "Authorization: Bearer ${ANYINT_API_KEY}" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"model": "veo-3.1-generate-preview",
"prompt": "A close up of two people staring at a cryptic drawing on a wall, torchlight flickering. A man murmurs, \"This must be it. That'\''s the secret code.\" The woman looks at him and whispers excitedly, \"What did you find?\""
}' | jq -r '.id'
)
echo "Created video operation: ${operation_id}"
# Poll the job until it's done
while true; do
status_response=$(
curl -s "${ANYINT_API_BASE}/videos/operations/${operation_id}" \
-H "Authorization: Bearer ${ANYINT_API_KEY}"
)
is_done=$(echo "${status_response}" | jq -r '.status')
echo "Current status: ${is_done}"
if [ "${is_done}" = "succeeded" ]; then
video_url=$(echo "${status_response}" | jq -r '.result.videos[0].url')
echo "Downloading video from: ${video_url}"
curl -L -o dialogue_example.mp4 "${video_url}"
echo "Generated video saved to dialogue_example.mp4"
break
elif [ "${is_done}" = "failed" ]; then
echo "Video generation failed:"
echo "${status_response}"
break
fi
sleep 10
done
import os, time, requests
BASE = os.environ["ANYINT_API_BASE"]
API_KEY = os.environ["ANYINT_API_KEY"]
prompt = "Panning wide shot of a calico kitten sleeping in the sunshine"
# Step 1 — Text → Image (e.g. gemini-2.5-flash-image)
img_resp = requests.post(
f"{BASE}/images/generations",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"model": "gemini-2.5-flash-image",
"prompt": prompt,
"n": 1,
"size": "1024x1024",
# You can also request base64 instead of URL if needed:
# "response_format": "b64_json"
},
timeout=60,
)
img_resp.raise_for_status()
img_data = img_resp.json()
# Assume the first image URL is what we want
image_url = img_data["data"][0]["url"]
print("Generated image URL:", image_url)
# Step 2 — Image + Text → Video (Veo 3.1)
create_resp = requests.post(
f"{BASE}/videos/generations",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"model": "veo-3.1-generate-preview",
"prompt": prompt,
"image_url": image_url, # pass guiding image to the video model
# Optional:
# "duration_seconds": 6,
# "aspect_ratio": "16:9"
},
timeout=60,
)
create_resp.raise_for_status()
operation = create_resp.json()
operation_id = operation["id"]
print("Created video generation job:", operation_id)
# Step 3 — Poll the video generation job
while True:
status_resp = requests.get(
f"{BASE}/videos/operations/{operation_id}",
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=60,
)
status_resp.raise_for_status()
op = status_resp.json()
status = op.get("status")
print("Current status:", status)
if status == "succeeded":
video_url = op["result"]["videos"][0]["url"]
break
if status == "failed":
raise RuntimeError(f"Video generation failed: {op.get('error')}")
time.sleep(10)
print("Video ready at:", video_url)
# Step 4 — Download the final video
video_resp = requests.get(video_url, timeout=300)
video_resp.raise_for_status()
with open("veo3_with_image_input.mp4", "wb") as f:
f.write(video_resp.content)
print("Generated video saved to veo3_with_image_input.mp4")