Use AI Chili with OpenAI Responses API (Hosted MCP) & OpenAI Agents SDK
Point OpenAI's Responses API Hosted MCP tool directly at https://aichili.ai/mcp with require_approval: 'always' on spend operations, or import https://aichili.ai/openapi.json into OpenAI Agents SDK function tools for typed multi-agent video pipelines.
https://aichili.ai/api/v1 · Streamable HTTP MCP https://aichili.ai/mcp · OpenAPI 3.1 /openapi.json.Architecture & Endpoint Overview
| OpenAI Pattern | Target Endpoint | Approval Gate | Latency & Control |
|---|---|---|---|
| Responses API Hosted MCP | https://aichili.ai/mcp | require_approval on create_video_generation | OpenAI cloud invokes AI Chili MCP directly; zero glue code |
| Agents SDK Function Tools | https://aichili.ai/api/v1/* | Python guard checks plan.total_credits <= cap | Full server-side secret custody; chili_sk_* stays in backend |
| OpenAPI 3.1 Schema Import | https://aichili.ai/openapi.json | 5 typed operationIds | Auto-generates strict JSON Schema tool definitions |
4-Step Implementation Blueprint
01 · Attach Hosted MCP for Discovery & Budgeting
Pass server_url: 'https://aichili.ai/mcp' inside the Responses API tools array with allowed_tools or require_approval configured.
02 · Keep chili_sk_* Keys Server-Side in Production
For customer-facing apps, wrap POST /api/v1/generations/plan and POST /api/v1/generations as Python @function_tool handlers so your Bearer key stays in backend memory.
03 · Enforce Programmatic Credit Caps
Assert plan_response['total_credits'] <= max_credits inside your tool wrapper before submitting POST /api/v1/generations.
04 · Poll Asynchronous Job Completion
Poll GET /api/v1/generations/{jobId} every 6-10 seconds until status equals 'succeeded' and return output_asset to the agent.
1. OpenAI Responses API with Hosted MCP (https://aichili.ai/mcp)
Allows the model to run read/estimate tools freely while requiring explicit approval before create_video_generation:
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-5",
tools=[
{
"type": "mcp",
"server_label": "aichili",
"server_url": "https://aichili.ai/mcp",
"require_approval": {
"never": {
"tool_names": [
"platform_overview",
"list_video_models",
"estimate_video_cost",
"plan_video_generation",
]
}
},
}
],
input="Compare h3-vdn 768p vs 2k credit cost for six 15-second wuxia shots using estimate_video_cost.",
)
print(response.output_text)
2. OpenAI Agents SDK Server-Side Function Tool (OpenAPI 3.1 Contract)
Keeps AICHILI_API_KEY strictly on your backend and enforces a hard credit budget via /api/v1/generations/plan:
import os
import httpx
from agents import Agent, Runner, function_tool
API_BASE = "https://aichili.ai/api/v1"
HEADERS = {
"User-Agent": "curl/8.4.0",
"Authorization": f"Bearer {os.environ['AICHILI_API_KEY']}",
"Content-Type": "application/json",
}
@function_tool
async def quote_and_submit_shot(prompt: str, duration_s: int = 15, ratio: str = "16:9", idem_key: str = "shot-01") -> dict:
payload = {
"mode": "t2v",
"model_id": "h3-vdn",
"idempotency_key": idem_key,
"params": {"prompt": prompt, "duration_s": duration_s, "resolution": "768p", "ratio": ratio},
}
async with httpx.AsyncClient(timeout=25.0) as http:
plan = (await http.post(f"{API_BASE}/generations/plan", headers=HEADERS, json=payload)).raise_for_status().json()
if plan["total_credits"] > 30:
raise ValueError(f"Shot quote {plan['total_credits']} credits exceeds 30-credit cap")
job = (await http.post(f"{API_BASE}/generations", headers=HEADERS, json=payload)).raise_for_status().json()
return {"job_id": job["id"], "quoted_credits": plan["total_credits"], "status": job["status"]}
director_agent = Agent(
name="StoryboardDirector",
instructions="Draft vivid camera-specific prompts and submit approved 768p shots via quote_and_submit_shot.",
tools=[quote_and_submit_shot],
)
Recommended AI Chili Engines for OpenAI Agents
H3-VDN
Deterministic per-second rate: 0.6 cr/s (480p), 1.0 cr/s (768p), 1.8 cr/s (1080p), 2.5 cr/s (2K), rounded up to whole credits (also accepts alias h3-sol).
Model Spec → wan3.0-videoWan 3.0
Live pre-calculated vendor quote via POST /v1/generations/plan before any credit is deducted (e.g. 5s 480P ≈ 8 credits; 30s unlocked on any paid PAYG pack).
Model Spec → minimax-h3-gmiMiniMax H3
Live pre-calculated quote via POST /v1/generations/plan (e.g. 4s 768P ≈ 11 credits; first 5 reference images included free).
Model Spec →Frequently Asked Questions
Does https://aichili.ai/openapi.json declare unique operationIds for every endpoint?
Yes. Every path in /openapi.json (OpenAPI 3.1.0) defines a unique camelCase operationId (listVideoModels, getCreditBalance, planVideoGeneration, createVideoGeneration, getVideoGeneration) and typed ErrorResponse schemas.
Why do the Python HTTP headers include User-Agent: curl/8.4.0?
Setting an explicit User-Agent prevents edge bot-filter false positives (Cloudflare 1010) that affect bare default scripting library headers.
How does idempotency work if an OpenAI tool runner retries a timed-out POST?
Pass idempotency_key in the JSON body (or Idempotency-Key HTTP header on /api/v1/generations); replaying the same key returns the existing job record at HTTP 200 without charging a second time.
Explore Other Stack Integrations
Claude Code
Attach AI Chili's remote Streamable HTTP MCP server (https://aichili.ai/mcp) to Claude Code in one command, install…
View Integration → AI IDE & Composer IntegrationCursor IDE
Add https://aichili.ai/mcp (or npx -y @aichili/mcp) to .cursor/mcp.json so Cursor Agent generates promo reels, UI…
View Integration → Visual Workflow Orchestrationn8n Workflows
Build reliable, budget-guarded n8n video workflows using four standard HTTP Request nodes: inspect GET…
View Integration → Backend Python 3.10+ IntegrationPython (SDK, urllib & httpx)
Install the official zero-dependency Python SDK, CLI & stdio MCP server via pip install…
View Integration → Next.js, Workers & Edge Runtime GuideTypeScript & Node 22
Run AI Chili across Node.js 22, Next.js Route Handlers, Cloudflare Workers, and Vercel Edge using standard Web Fetch…
View Integration →