Cookbook
Short, copy-paste recipes for common tasks and the tools you already use. Everything points at https://api.apigator.ai/v1 with your Apigator key. Full reference: /docs.
from openai import OpenAI
client = OpenAI(base_url="https://api.apigator.ai/v1", api_key="sk-...")
r = client.chat.completions.create(model="gpt-4o",
messages=[{"role":"user","content":"Hello!"}])
print(r.choices[0].message.content) curl https://api.apigator.ai/v1/images/generations \
-H "Authorization: Bearer sk-..." \
-d '{"model":"openai/gpt-image-1","prompt":"a red crocodile mascot","n":1}' curl https://api.apigator.ai/v1/audio/transcriptions \
-H "Authorization: Bearer sk-..." \
-F model="groq/whisper-large-v3" \
-F file=@speech.mp3 Embed your chunks, store the vectors, embed the query, retrieve nearest, then answer with chat.
from openai import OpenAI
client = OpenAI(base_url="https://api.apigator.ai/v1", api_key="sk-...")
def embed(texts):
r = client.embeddings.create(model="openai/text-embedding-3-small", input=texts)
return [d.embedding for d in r.data]
# 1) embed + store your docs' vectors 2) embed the query 3) retrieve top-k by cosine
# 4) pass the retrieved text as context to client.chat.completions.create(...) Ask typed questions about any text and get calibrated probabilities back — no parsing. Not a chat model; it has its own endpoint. More: /jev.
import requests
r = requests.post(
"https://api.apigator.ai/v1/decisions",
headers={"Authorization": "Bearer sk-..."},
json={
"model": "typesafe/jev-latest",
"input": "Help! My payouts have been failing for 3 days.",
"questions": [
{"name": "department", "type": "choice", "instructions": "Which team should handle this?",
"choices": [{"value": "billing", "description": "Payments"},
{"value": "technical", "description": "Bugs, integrations"},
{"value": "sales", "description": "Pricing"}]},
{"name": "is_urgent", "type": "predicate", "instructions": "Does this convey urgency?"},
],
},
)
a = {x["name"]: x for x in r.json()["answers"]} # answers come back in question order
print(a["department"]["choice"], a["department"]["confidence"]) # billing 0.8
print(a["is_urgent"]["probability"]) # 0.95 = P(yes) Apigator is OpenAI-compatible, so anything that lets you set a base URL + key works.
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(base_url="https://api.apigator.ai/v1", api_key="sk-...", model="gpt-4o") import { createOpenAI } from "@ai-sdk/openai";
const apigator = createOpenAI({ baseURL: "https://api.apigator.ai/v1", apiKey: process.env.APIGATOR_KEY });
// const { text } = await generateText({ model: apigator("gpt-4o"), prompt: "Hi" }); Settings → Models → OpenAI API Key: set Override Base URL to https://api.apigator.ai/v1, paste your Apigator key, and add a model id (e.g. gpt-4o).
Pick the OpenAI Compatible provider; Base URL https://api.apigator.ai/v1, API key sk-..., model any id from /models. For Aider: OPENAI_API_BASE=https://api.apigator.ai/v1 OPENAI_API_KEY=sk-... aider --model gpt-4o.
One command: curl -fsSL https://apigator.ai/setup-claude-cli.sh | bash. Full guide: /claude-cli.