Apigator by MixerBox

Cookbook

레시피

자주 하는 작업과 이미 쓰고 있는 도구를 위한 짧은 복사·붙여넣기 레시피입니다. 모두 https://api.apigator.ai/v1와 Apigator 키를 사용합니다. 전체 레퍼런스: /docs.

작업

채팅 (Python)

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

임베딩 → RAG

청크를 임베딩해 벡터를 저장하고, 쿼리를 임베딩해 가장 가까운 항목을 검색한 뒤 채팅으로 답변합니다.

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(...)

판단 모델: 분류 및 라우팅 (TypeSafe Jev)

어떤 텍스트에 대해서든 타입이 지정된 질문을 하고 보정된 확률을 받습니다 — 파싱이 필요 없습니다. 채팅 모델이 아니며 전용 엔드포인트가 있습니다. 자세히: /jev.

import requests

r = requests.post(
    "https://api.apigator.ai/typesafe/v1/systemone",
    headers={"Authorization": "Bearer sk-..."},
    json={
        "model": "jev-latest",
        "state": "Help! My payouts have been failing for 3 days.",
        "questions": {
            "department": {"type": "choice", "instructions": "Which team should handle this?",
                           "criteria": {"billing": "Payments", "technical": "Bugs, integrations", "sales": "Pricing"}},
            "is_urgent": {"type": "noul", "instructions": "Does this convey urgency?"},
        },
    },
)
a = r.json()["answers"]
print(a["department"]["choice"], a["department"]["confidence"])  # billing 0.81
print(a["is_urgent"]["noul"])                                    # 0.95 = P(yes)

사용 중인 도구와 함께

Apigator는 OpenAI 호환이므로 base URL과 키를 설정할 수 있는 도구라면 무엇이든 동작합니다.

LangChain (Python)

from langchain_openai import ChatOpenAI
llm = ChatOpenAI(base_url="https://api.apigator.ai/v1", api_key="sk-...", model="gpt-4o")

Vercel AI SDK (Node)

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" });

Cursor

Settings → Models → OpenAI API Key: Override Base URLhttps://api.apigator.ai/v1로 설정하고, Apigator 키를 붙여넣은 뒤 모델 id(예: gpt-4o)를 추가하세요.

Cline / Continue / Aider

OpenAI Compatible 공급자를 선택하세요. Base URL https://api.apigator.ai/v1, API 키 sk-..., 모델은 /models의 아무 id나 사용할 수 있습니다. Aider의 경우: OPENAI_API_BASE=https://api.apigator.ai/v1 OPENAI_API_KEY=sk-... aider --model gpt-4o.

Claude Code CLI

명령어 하나: curl -fsSL https://apigator.ai/setup-claude-cli.sh | bash. 전체 가이드: /claude-cli.