API Quickstart & Advanced Examples
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)
export ANYINT_API_BASE="https://gateway.api.anyint.ai/openai/v1"
export ANYINT_API_KEY="sk-************************"Text to Text Models
2) Minimal HTTP Examplesbash
2.1 cURL
curl -X POST "$ANYINT_API_BASE/chat/completions" \
-H "Authorization: Bearer $ANYINT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1-mini",
"messages": [{"role":"user","content":"Hello, ANYINT!"}]
}'2.2 Node.js (native fetch, Node 18+)
2.3 Python (requests)
3) Streaming (SSE)
3.1 Node.js (manual SSE parsing)
3.2 Python (requests stream)
4) Video & Image Models
Besides text chat models, the AnyInt Gateway also exposes image and video generation models (e.g. veo-3.1-generate-preview, gemini-2.5-flash-image).
You call them over plain HTTP using your existing ANYINT_API_BASE and ANYINT_API_KEY.
⚠️ Note: Video generation is a long-running operation.
You first create a generation job, then poll its status, and finally download the resulting video file.
4.1 Text → Video generation
Generate a short video directly from a text prompt (e.g. Veo 3.1).
5.1.1 Python (requests)
4.1.2 cURL (REST + jq)
4.2 Image → Video generation
You can also generate a guiding image first, then feed it into a video model (e.g. Veo) to create a more consistent clip.
5.2.1 Python (requests)
5) Security & Go-Live Tips
Do not expose your API key in the browser; route calls from your backend.
Configure timeouts, retries, and concurrency limits to avoid cost spikes and 429s.
When you need structured output, prefer models with native json_schema; otherwise use json_object + client-side validation.
Last updated