GPT-6.1 Sol function calling to start a Sume Agent Completion safely
Expose one function that starts an Agent Completion. Let GPT-6.1 Sol fill instruction and input, and keep the spend cap and idempotency key out of its args.

Give the model a function whose parameters are only the creative fields, and add the money fields yourself. OpenAI's model page lists function calling as supported for GPT-6.1 Sol. The function schema should hold instruction and input. Your handler adds generation_spend_cap_usd, which Agent Completions require, and an Idempotency-Key that you derive.
Which side owns which field
Keep untrusted text in input, since Sume gives input to the agent as caller data, not as instructions. Put only your own wording in instruction.
| Field | Owner | Note |
|---|---|---|
instruction | Model, from your template | Short and specific |
input | Model | Caller data from the user |
generation_spend_cap_usd | Handler | Required, no default |
Idempotency-Key header | Handler | One per tool call id |
import os
import requests
def start_completion(call_id: str, args: dict, cap_usd: float) -> str:
r = requests.post(
"https://api.sume.com/v1/agent/completions",
headers={"Authorization": f"Bearer {os.environ['SUME_API_KEY']}",
"Idempotency-Key": f"call-{call_id}"},
json={"instruction": args["instruction"], "input": args.get("input", {}),
"generation_spend_cap_usd": cap_usd},
timeout=30,
)
r.raise_for_status()
return r.json()["data"]["status_url"]
Return a pointer, not the media
Return the status_url to the model as the tool result, and poll it in your own loop. Do not let the model poll in a tight loop, since each turn has its own cost.
Check the docs before you ship
Sume's limits and field names change faster than blog posts do. Read the linked docs pages for the current request fields before you ship, and send a dry_run or a low spend cap on your first real call.
Sources
Related posts
More in Integrations
- Read-only MCP session lists avatars; create gives insufficient_scope
A hosted MCP connection with read scope can list and search avatars, but paid avatar and video tools return insufficient_scope until you grant write.
- jobs_wait defaults to 50 seconds: how many calls for a long render
Remote MCP jobs_wait waits 50 seconds by default and 55 at most. A render that takes N minutes needs about N x 60 / 50 calls on the same ids. Never resubmit.
- kling-motion-control_create: motion_video_url, 1 to 30 s, no model
kling-motion-control_create needs a public HTTPS motion_video_url and duration_seconds of 1 to 30, and refuses a model field with provider_fields_not_accepted.
- Linktree video background 50 MB limit: bitrate budget by length
Linktree video backgrounds loop with no time limit but a 50 MB cap. A 15-second loop can average 26.7 Mbps, a 60-second one 6.7 Mbps. Table and trim steps.
Written by Sume