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.

5 min readSume
All posts

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.

From Google's Gemini 3.8 Flash post and the Gemini API latest-models page, read 2026-09-29.
ItemValue
Model idgemini-3.8-flash
Released2026-09-02
Context / output1M 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

All Developers posts

Written by Sume