Gemini 3.8 Flash function calling: let it start a Sume video job
Declare a function for Gemini 3.8 Flash, run it against Sume's /v1/videos when the model returns a functionCall, and reply with a functionResponse with job id.

To let Gemini 3.8 Flash start a video, declare a function with a name, description and parameters, send it with the request, and when the response contains a function call, run it yourself against Sume's POST /v1/videos and send the job id back as a function response. The model never calls Sume directly in this route; your code does.
Google's launch post says Gemini 3.8 Flash arrived on Sep 2, 2026, and the Gemini API's latest-models page lists model id gemini-3.8-flash with a 1M context and 64k output. The request shape comes from Google's function-calling page. All three were read 2026-09-29. Those pages did not confirm MCP support, so this post uses plain function calling.
What do Google's pages list for the model?
The launch post prints an introductory price and the one that follows it.
| Item | Value |
|---|---|
| Model id | gemini-3.8-flash |
| Released | 2026-09-02 |
| Context / output | 1M tokens / 64k tokens |
| Introductory price, through Dec 31 2026 | $0.75 input, $3.75 output |
| Price afterwards | $1.50 input, $7.50 output |
What is the request?
Google's REST endpoint is models/gemini-3.8-flash:generateContent on generativelanguage.googleapis.com, with the key in x-goog-api-key. The function goes under tools in functionDeclarations.
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role": "user", "parts": [{"text": "Make a 5 second clip of a paper boat."}]}],
"tools": [{"functionDeclarations": [{
"name": "start_video",
"description": "Start a video job and return its job id.",
"parameters": {
"type": "object",
"properties": {"prompt": {"type": "string"}},
"required": ["prompt"]
}
}]}]
}'What does my code do with the function call?
Read the functionCall part, then post its arguments to Sume with your key and an Idempotency-Key header. The create call answers at once with an id and a polling_url.
curl -X POST https://api.sume.com/v1/videos \
-H "Authorization: Bearer $SUME_API_KEY" \
-H "Idempotency-Key: gemini-call-001" \
-H "Content-Type: application/json" \
-d '{"model": "sume/auto", "prompt": "A paper boat in a rain gutter", "duration": 5}'How do I return the result?
Google's page says to return a functionResponse with the matching id and name. Put the Sume job id and status in its response body, and add a second declared function that does GET /v1/videos/<job_id> so the model can ask again later. When the job is completed, the download URL is unsigned_urls[0].
Sources
Related posts
More in Developers
- Golang HTTP client retry: what net/http retries on POST
Go's http.Transport retries only network errors on reused connections, and a POST only with an Idempotency-Key header. Write the 429 and 5xx loop yourself.
- GPT-6 Astra tool calling needs the Responses API: meaning for Sume
OpenAI says GPT-6 Astra supports Chat Completions but its tool calling requires Responses. Use the Responses mcp tool for Sume, not a chat.completions loop.
- GPT Image 2.5 4K: how to request a 3840x2160 image by API
To get a 4K image from GPT Image 2.5 on Sume, send image_size 3840x2160 to POST /v1/images and be ready for a 202 job response. Request, cost, and polling.
- GPT Image 2.5 image editing API: edit a photo with a prompt
Edit a photo with GPT Image 2.5 on Sume: send the image in input_references, describe the change, and set aspect_ratio to auto. Up to 16 references per call.
Written by Sume