SerpBase
Back to Blog

Google AI Mode API in Other Languages: German, Japanese and More With hl and gl

Ask AI Mode in the target language with hl and gl. Tested in German and Japanese: local-language answers, local sources, translated highlight labels.

December 5, 2026
By SerpBase Team3 min read

Short answer: send the question in the language you want together with hl (language) and gl (country) to /google/ai_mode; the answer and its sources come back in that language. On 5 December 2026 a German question with "hl":"de","gl":"de" returned a German answer citing German pages, and a Japanese question with "hl":"ja","gl":"jp" a Japanese answer citing Japanese sites.

The request

curl -X POST 'https://api.serpbase.dev/google/ai_mode' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -d '{"q":"wie funktioniert eine wärmepumpe","hl":"de","gl":"de"}'

What came back

questionhl / glanswer lengthsourcestime
wie funktioniert eine wärmepumpede / de3,500 characters36.5 s
ヒートポンプの仕組みja / jp1,026 characters34.0 s

The German answer, shortened:

{
  "status": 0,
  "credits_charged": 3,
  "ai_mode": {
    "text": "Eine Wärmepumpe funktioniert im Prinzip genau wie ein umgekehrter Kühlschrank: [Beginn der Markierung] Während ein Kühlschrank seinem Innenraum Wärme entzieht … [Ende der Markierung]\n\nDazu nutzt sie einen geschlossenen Kreislauf …",
    "markdown": "Eine Wärmepumpe funktioniert im Prinzip genau wie ein **umgekehrter Kühlschrank**: …",
    "sources": [
      {
        "title": "Bosch Home Comfort",
        "page_title": "Wie funktioniert eine Wärmepumpe? Einfach erklärt | Bosch",
        "link": "https://www.bosch-homecomfort.com/de/de/wohngebaeude/wissen/heizungsratgeber/waermepumpe/waermepumpe-funktion/"
      }
    ]
  }
}

The other two German sources were German-language YouTube videos. The Japanese answer cited Panasonic's Japanese site, the Heat Pump & Thermal Storage Technology Center of Japan (hptcj.or.jp) and the Japan Electro-Heat Center (jeh-center.org). Both answers had numbered steps and short headings in markdown, and the same content as plain text in text.

Python: ask in several languages

import re, requests

QUESTIONS = [
    ("wie funktioniert eine wärmepumpe", "de", "de"),
    ("ヒートポンプの仕組み", "ja", "jp"),
]

# Google marks a highlighted passage with bracketed labels in the page language,
# e.g. [Highlight start] / [Beginn der Markierung] / [ハイライトの開始].
MARKER = re.compile(r"\s?\[(Highlight (start|end)|Beginn der Markierung|Ende der Markierung|ハイライトの(開始|終了))\]\s?")

for q, hl, gl in QUESTIONS:
    r = requests.post(
        "https://api.serpbase.dev/google/ai_mode",
        headers={"X-API-Key": "YOUR_API_KEY"},
        json={"q": q, "hl": hl, "gl": gl},
        timeout=60,
    ).json()
    if r["status"] != 0:
        print(q, "failed:", r.get("error"))
        continue
    answer = MARKER.sub(" ", r["ai_mode"]["text"]).strip()
    print(f"[{hl}] {answer[:200]}")
    for s in r["ai_mode"]["sources"]:
        print("   source:", s["title"], s["link"])

Things that trip people up

  • Write the question in the target language. hl and gl set the language and country of the Google page; the question itself is sent exactly as you give it.
  • Highlight labels are translated. The text and markdown fields can contain Google's highlight labels — "[Highlight start]" in English, "[Beginn der Markierung]" in German, "[ハイライトの開始]" in Japanese. Strip them as in the code above; other languages will have their own wording.
  • The text can mention things that are not returned. The German answer said an explainer video illustrates the cycle; the video itself is not part of ai_mode. Only the cited pages are, in sources.
  • AI Mode is not the AI Overview. The same German question on /google/search with "gl":"de","hl":"de" returned 9 German organic results and no AI Overview. If you need an AI answer in another language, AI Mode is the endpoint that returned one. See AI Mode vs AI Overview.
  • 3 credits per answer, in both languages we tested.

Related

Cost and docs

An AI Mode answer is 3 credits; credits cost $0.25–$0.50 per 1,000 depending on the pack. Failed requests are not charged, and new accounts get 500 free credits.