Hosted MCP & OpenAPI 3.1 Tool Calling

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.

Last updated: By AI Chili Platform & Developer Experience Team Entity: AI Chili Inc. (Vancouver, BC)
Key Endpoints: REST Gateway https://aichili.ai/api/v1 · Streamable HTTP MCP https://aichili.ai/mcp · OpenAPI 3.1 /openapi.json.

Architecture & Endpoint Overview

OpenAI PatternTarget EndpointApproval GateLatency & Control
Responses API Hosted MCPhttps://aichili.ai/mcprequire_approval on create_video_generationOpenAI cloud invokes AI Chili MCP directly; zero glue code
Agents SDK Function Toolshttps://aichili.ai/api/v1/*Python guard checks plan.total_credits <= capFull server-side secret custody; chili_sk_* stays in backend
OpenAPI 3.1 Schema Importhttps://aichili.ai/openapi.json5 typed operationIdsAuto-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

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