|

Using GLM-5.4 for Multimodal Frontend Fixing: From API Invocation to Result Verification

Using GLM-5.4 for Multimodal Frontend Fixing: From API Invocation to Result Verification

A blocked button is an awkward kind of bug: there’s no console error, the page runs, the API calls go through—but the “Submit Order” button in the bottom-right is half-covered by a “Need help?” overlay. To fix it, you need to look at two things at once: the picture you can see, and the few lines of CSS that determine that picture.

This isn’t another post about prompt folklore. It’s about one practical path you can actually ship: give GLM-5.4 a real viewport screenshot together with the corresponding source code, have it produce a CSS patch based on the context you provide, and then have a human click the blocked button once to verify.

The core value: after reading this, you’ll know how to write the officially required image_url block, why reasoning_effort can’t be left empty, and how to deal with the fact that the current type annotation for this glm-5.4 on APIYI says text—start by probing with a small image; if that doesn’t work, switch to gemini-4-carbon, whose vision capability is listed on its model page, without changing a single character in the workflow.

fix-covered-button-with-glm-5-4-screenshot-and-css-patch-en-image-0


When a Button Gets Covered, Which Part Is the AI Actually Handling?

Let’s draw the boundary clearly first, so the rest of the steps don’t go off track. The model can do exactly two things: translate the obstruction in a screenshot into “which two elements, at what viewport width, and how much they overlap,” then find the corresponding positioning rules in the source code you provide and output a patch with as small a change footprint as possible.

What it can’t do is just as clear. It can’t judge whether the patch is acceptable under your design guidelines, and it can’t tap that button for you—it also can’t see the hover state, the focus ring, or what things look like after the virtual keyboard pushes the layout up. So the whole chain naturally has four stages: the first two are interface problems, the third is a model-capability problem, and the fourth can only be handled by a human.

Stage Who does it Output Acceptance criteria
Capture a real-viewport screenshot Human A screenshot annotated with the viewport width The obstruction is visible at a glance in the image
Read the image and locate the overlap GLM-5.4 Which two elements overlap, and where the overlap region is Can describe the visible features of the elements
Write a patch against the source code GLM-5.4 A CSS diff Small change footprint, no new obstruction introduced
Tap the covered button once Human Pass or send back A finger can actually tap it

Why You Must Provide a Real Viewport Screenshot, Not a Cropped Region

Downscaled images, desktop-width screenshots, or a small crop from DevTools all make the model lose its sense of scale when it comes to “things being crammed together.” If you hand it a 1440px-wide desktop screenshot and ask “why is the button covered on mobile,” it can only guess. The patch it guesses will most likely bump up some bottom value, even though that value is already a different set of rules in your media queries.

The source code is the same—don’t dump the entire site in. Give it too much and its attention gets spread across irrelevant styles, which actually makes the patch’s change footprint bigger. The safer approach is to put three pieces of information in the same passage: viewport width, the visible symptom, and the relevant HTML structure plus CSS (including the media query lines). With all three, it has a chance to locate the two rules that are actually fighting each other.

fix-covered-button-with-glm-5-4-screenshot-and-css-patch-en-image-1


GLM-5.4 reads screenshots to fix occlusion — the official way to send images

The official model page spells it out: the model code is glm-5.4, input modalities are Video / Image / Text / File, output is text, context window is 1M, max output 128K. In other words, sending images is part of the official API’s capabilities — not some bolt-on trick.

The concrete approach: add a block with type set to image_url inside the content array of messages, and put the image URL in image_url.url (the officially recommended method), or use a Base64 Data URL. For multiple images, just add more blocks, ordered the way you want the model to read them.

{
  "model": "glm-5.4",
  "messages": [
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "视口宽度 390 CSS 像素。右下角按钮被浮层挡住,下面是相关 HTML 与 CSS……"},
        {"type": "image_url", "image_url": {"url": "https://your-cdn.example.com/viewport-390.png"}}
      ]
    }
  ],
  "temperature": 1,
  "top_p": 0.95,
  "reasoning_effort": "max"
}

If you’re calling through an aggregator, just point base_url at https://api.apiyi.com/v1. Everything else stays exactly as the official docs say — no need to change the structure. The official docs also give recommended values for the parameters; for an occlusion-fixing task, it’s best to follow them as-is. The reasons are in the right-hand column.

Parameter Official recommendation Why you should follow it when fixing occlusion
temperature 1 Run the same screenshot twice and the patching ideas stay comparable
top_p 0.95 Pairs with temperature — don’t tweak just one of them
reasoning_effort max max is the default, but writing it explicitly tells you which tier you’re paying for
thinking.type Can only be enabled The official docs note these models can’t have thinking turned off
thinking.clear_thinking false Keep the thinking content so multi-turn follow-ups stay coherent
tool_stream Add it for streaming calls When you want to watch and edit at the same time, tool calls won’t get stuck

🎯 Technical tip: If you don’t have a usable key on hand yet, you can grab a free trial quota through APIYI at apiyi.com. The endpoint uses OpenAI-compatible formatting — just send the JSON above and you can verify whether the image-sending channel works.


Don’t Leave reasoning_effort Blank: You Can’t Turn Off Thinking in GLM-5.4

This is a pitfall a lot of people hit on their first try. The official thinking-mode docs spell it out: GLM-5.4, GLM-5.3, and GLM-5.3-Flash are all forced-thinking models — you can’t switch it off with type: disabled, and thinking.type only accepts enabled. Starting with GLM-5.4, retained thinking is on by default (clear_thinking defaults to false), and that’s how it behaves across every endpoint.

So what “leaving it blank” actually means is this: you’ve accepted the default value of max, not saved yourself the cost of thinking. Keep that in mind. Either explicitly write max to confirm you’re okay with it, or explicitly dial it down a notch — don’t let a default make the cost decision for you.

There’s another rule that’s easy to overlook when you’re doing multi-turn follow-ups: the official guidance requires you to send back the original reasoning_content in its original order. Drop it, and the model re-derives all the layout relationships from scratch — the slowness is the minor issue; the bigger hassle is that the two patches can contradict each other, with the first telling you to add padding-bottom and the second telling you to remove it.

The output cap is 128K, but thinking content eats into that budget too. Throw the whole site’s CSS in at once and both price and latency will look ugly — which is the practical reason behind the earlier emphasis on “only give it the relevant section.”

APIYI’s glm-5.4 listing says “text” in the type column

Let’s be honest here—otherwise you’ll get stuck at step one. As of what I could see on 2026-12-03, glm-5.4 shows up in both APIYI’s overview table and pricing API, with input at $1.4, output at $4.4, and cache reads at $0.26. The only endpoint is chat, and the groups are Default and SVIP—but the type column says text, and this listing has no dedicated model page.

What that means: nowhere on the platform does it explicitly say “glm-5.4 can accept images.” The official model page says it supports image input, while the platform’s type column says text. Those two things don’t conflict, but they can’t substitute for each other either. Your move here isn’t to gamble—it’s to test with one small image first.

Model APIYI type column Available endpoints Input Output Cache read
glm-5.4 Text chat $1.4 $4.4 $0.26
glm-5.3 Text chat, messages $1.4 $4.396 $0.259
gemini-4-carbon Text (model page separately states visual understanding) See model page $4 $20 $0.2

Notice how the last row is written: gemini-4-carbon’s model page explicitly states visual understanding, and its input includes text, images, video, and audio, yet the overview table’s type column still says text for it. Both pieces of information exist side by side. When you’re reading them, defer to the model page—don’t just look at the overview table. glm-5.3 also has an extra ClaudeCode group and uses the messages endpoint; that’s the platform-side difference between it and glm-5.4.

💡 Verification tip: It’s worth checking these fields yourself against APIYI apiyi.com’s model overview table and pricing API. Model types and prices change irregularly, so go by the page on the day you make the call.

fix-covered-button-with-glm-5-4-screenshot-and-css-patch-en-image-2


Quick start: test the path with a small image first, then use real occlusion screenshots

Follow four steps, and don’t reorder them. Step one: prepare your materials. Step two: spend a few dozen seconds confirming the channel works. Only then, in step three, send the real materials in. Step four: go back to the page and click once.

Step 1: Prepare a real viewport screenshot and the matching source code

Use a real device or the browser’s device mode, set the viewport to the exact width where the problem actually occurs—say, 390 CSS pixels—and take a full-screen screenshot, not a cropped partial one. Copy the HTML structure for that same screen along with the relevant CSS. Don’t leave out the media query lines—those are especially important—and note the viewport width in the text while you’re at it.

There’s a ready-made example you can reference for the scenario: a third-party tutorial uses a checkout page that’s 390 CSS pixels wide as a demo, where a “Need help?” overlay covers the bottom-right corner of the “Submit Order” button; the author sends the screenshot and checkout.html together. This is just a scenario illustration, not a validation result from this article. You can just prepare your own materials following this approach. Third-party tutorial: evolink.ai/zh/blog/how-to-use-glm-5-4.

Step 2: Probe the channel with one small image

The goal here isn’t to fix bugs — it’s to confirm whether this channel accepts images at all. Grab a small image of a few dozen KB (Base64 works too) and ask a question that can be answered in one sentence, like: what’s the clickable element in the bottom-right corner of the image?

import openai

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.apiyi.com/v1"
)

resp = client.chat.completions.create(
    model="glm-5.4",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "这张图里最靠右下的可点击元素是什么?只回元素文字。"},
            {"type": "image_url", "image_url": {"url": "data:image/png;base64,<your small image>"}}
        ]
    }],
    temperature=1,
    top_p=0.95,
    reasoning_effort="max"
)
print(resp.choices[0].message.content)

The pass/fail rule is simple: if it can tell you the text of that element, the channel works. If it errors out, says it can’t see the image, or answers something completely unrelated, treat it as broken and jump straight to Step 4 to switch models. Don’t keep rewriting the prompt at this stage — whether the probe gets through is a channel problem, not a wording problem. You can reword it ten times and it still won’t work.

Step 3: Send a real screenshot together with the source code

Once the channel is confirmed, swap in the material from Step 1. The text block should spell out four things: the viewport width, a description of the symptom, the source snippet, and the constraints. A lot of people skip the constraints item, but it’s the switch that controls patch quality. Explicitly write “only change CSS, don’t touch the structure, don’t introduce !important, keep the changes within two rules”, and the diff you get back will be much cleaner.

Same call, base_url is still https://api.apiyi.com/v1 — just replace image_url with the URL of your real screenshot and swap the text block for the source code. If you pass the image by URL, remember it has to be a public address the model side can actually reach; for local files, convert them to a Base64 Data URL. Both are officially supported.

Step 4: If it doesn’t work, switch to gemini-4-carbon

If step 2 tells you it’s a no-go, don’t spin in circles, and don’t assume based on the official docs that this model can handle images on the platform. Just switch models: the model page for gemini-4-carbon explicitly lists visual understanding, with inputs covering text, images, video, and audio — $4 input, $20 output, $0.2 cache read.

Nothing in the flow changes — still a screenshot plus source code, still the same content array structure, just swap model to gemini-4-carbon. The pricing is different, so you’ll need to work the cost out yourself; but at least this step won’t get stuck on “can this thing even accept images.”

Whenever glm-5.4 gets a model page on APIYI that explicitly states image understanding capability, you can switch back — no rush.

🚀 Quick start: the fastest way to validate the whole flow is to create a key through APIYI at apiyi.com, run step 2 with a small image first, then decide on your main model — that way you don’t burn half a day on asset prep before you’ve even started.


A patch in hand isn’t acceptance until a human taps it once

The patch the model hands you is inferred from a single static screenshot. It solves “overlap on screen,” which isn’t the same as “the finger can actually tap it.” Several layers sit in between: the viewport shrinks when the keyboard comes up, longer button text pushes the layout open, fixed elements shift position after scrolling, the focus ring gets covered and becomes invisible. The model sees none of that.

So acceptance can only be a human tapping once — and tapping through a fixed set of actions. The check order in the table below is worth following as-is, starting from the default state and adding difficulty layer by layer.

Check How to test If it fails
Default state Tap the obstructed button directly on a real device Means the patch missed the positioning rule
Keyboard up Focus the input first, then tap the button Change bottom instead of raising top
Long text Make the button text twice as long Use min-height or a wrapping strategy
Narrow screen Check again at 320 width Add a media query, don’t change it globally
Layer toggling Toggle the other overlays one by one Check the layering relationships instead of adding numbers

The most common mistake in patches is slamming z-index straight to 9999. Sure, that brings the button up — but the obstruction just moves from the button to somewhere else, like covering the top nav. A more reliable fix is to go back to the layering itself: check whether the two elements are in the same stacking context, whether you can use position plus spacing to move the overlay out of the way, rather than competing over whose level is bigger.

If the patch changes more than three rules, or introduces !important, I’d just send it back for a redo. Fixing one obstructed button shouldn’t require that big a surface area — the bigger the change, the more uncontrollable the regression risk.


There are two price sets—don’t mix them

I need to keep these separate here, because the official list price is in RMB while APIYI’s is in USD. These are prices from two different billing systems. Don’t convert them into a single number and use them interchangeably, and don’t use one set to infer the other.

From the official Chinese price list, as read this time: GLM-5.4 and GLM-5.3 are priced the same—8 yuan input, 28 yuan output, and 2 yuan per million tokens for cache hits. Cache storage is free for a limited time, and the context window is 1M. The input modality column differs between the two: GLM-5.4 lists image, video, file, and text, while GLM-5.3 lists text.

Item GLM-5.4 (official RMB) GLM-5.3 (official RMB)
Input 8 yuan / million tokens 8 yuan / million tokens
Output 28 yuan / million tokens 28 yuan / million tokens
Cache hit 2 yuan / million tokens 2 yuan / million tokens
Cache storage Free for a limited time Free for a limited time
Context 1M 1M
Input modality Image, video, file, text Text

On APIYI’s side, pricing is in USD: glm-5.4 input $1.4, output $4.4, cache read $0.26; glm-5.3 input $1.4, output $4.396, cache read $0.259; gemini-4-carbon input $4, output $20, cache read $0.2. Check the currency before comparing prices—don’t convert or infer between the two sets of numbers.

Fixing a button overlap usually takes one or two requests: one small-image connectivity check, one real request with the source code, and occasionally one follow-up. The real cost is on the output side—that is, the reasoning content. This is also why I kept stressing earlier not to leave reasoning_effort blank: you need to know which tier you’re paying for.


Frequently Asked Questions (FAQ)

Q1: What is the “use GLM-5.4 to inspect a screenshot and fix button overlap” workflow?

You send a real viewport screenshot together with the relevant source code to a multimodal model, and ask it to pinpoint which two elements are colliding. It then outputs a CSS patch against the source. Finally, a human clicks the obscured button once to verify. The model handles locating and rewriting; the human handles judging and clicking.

Q2: What’s the difference between GLM-5.4 and gemini-4-carbon for fixing overlap?

GLM-5.4’s official model page states that its input modalities include images, with a 1M context window. But on APIYI, the type column for this entry says text, and there’s no dedicated model page — so you have to probe with a small image first to confirm. The gemini-4-carbon model page explicitly lists visual understanding, with input covering text, images, video, and audio, so you can rely on that directly when you need image reading — at the cost of a higher unit price. The request structure is identical for both, so switching models doesn’t require changing the workflow.

Q3: What happens if reasoning_effort is left blank?

It doesn’t turn off thinking. GLM-5.4, GLM-5.3, and GLM-5.3-Flash are forced-thinking models; `thinking.type` only accepts `enabled`, and the default `reasoning_effort` is max. Leaving it blank really means you’ve accepted the most expensive tier, not that you’ve saved on thinking budget. It’s better to write it out explicitly and treat it as a parameter you need to decide for yourself.

Q4: Why does it have to be a real viewport screenshot? Can’t I just crop a small region?

Cropping a local region throws away scale information. The model can’t tell how two elements are squeezed together at 390 CSS pixels, so all it can offer is bland advice like “increase the spacing.” A full-screen screenshot plus a viewport width annotation is what lets it line things up with those media queries in your source code.

Q5: How do I call glm-5.4 on APIYI to pass in an image?

Register and get a key, point `base_url` at `https://api.apiyi.com/v1`, set `model` to `glm-5.4`, and put a block with `type` set to `image_url` inside the `content` array, with a public URL or a Base64 Data URL in `url`. Include `reasoning_effort` explicitly at the same time. Start with a small image of a few dozen KB and confirm it can read the text of the elements in the image before moving on to real assets. You can claim credits at APIYI apiyi.com.

Q6: Is a patch containing !important or z-index: 9999 usable?

It runs, but don’t accept it. `z-index: 9999` just moves the overlap somewhere else — the usual consequence is covering the top navigation; `!important` removes your ability to reason about layering later on. A more stable approach is to go back to the stacking context itself and move the floating layer away using spacing or positioning. If the change touches more than three rules, it’s best to have it regenerate the patch.

Q7: What are the known limitations of this workflow?

Three of them: a static screenshot can’t show hover states, focus rings, or the layout after the keyboard pops up; the platform’s type column and the official model page may disagree — which is exactly the situation with glm-5.4 right now, so you can only confirm by probing with an image; and patch quality depends on the scope of source code you provide — give too much and the change surface grows, give too little and the localization is inaccurate. The verification step always requires a human.


Key Takeaways for Fixing Obscured Buttons

  • Keep the division of labor clear: The model locates the overlap and produces a CSS patch, while a human clicks the obscured button once. Neither can replace the other.
  • There’s a fixed way to send images: Add a block with type set to image_url in the content array — either a URL or a Base64 Data URL works.
  • Thinking can’t be turned off: GLM-5.4 forces thinking. thinking.type only accepts enabled, and leaving reasoning_effort empty gets billed as max.
  • Verify the platform type: On APIYI, glm-5.4’s type column says text and there’s no model page — don’t assume it can receive images.
  • Probe first, then commit: If a tiny image of a few dozen KB gets it right in one sentence, then send the real viewport screenshot and source code.
  • If probing fails, switch: The gemini-4-carbon model page explicitly states visual understanding. Keep the request structure the same and just swap the model.
  • Getting started path: Open a key at APIYI apiyi.com, set base_url to https://api.apiyi.com/v1, and get image probing working before you talk about fixing bugs.

Summary

When it comes to buttons getting obscured, the part AI can actually help with is pretty clear:

  1. Locate: Translate the obstruction in the screenshot into specific elements and overlapping regions, saving you the time of digging layer by layer in DevTools.
  2. Rewrite: Produce a CSS patch against the snippet of source code you provide — small in scope and easy to roll back.
  3. Accept: Put the patch back on the page and have a human click the obscured button once. It’s only done when that passes.

Don’t expect it to nail it in one go, and don’t expect it to judge whether the design is reasonable for you. Follow the order “real material → small-image probe → real request → human click once,” and the vast majority of obstruction issues can be resolved within two rounds.

We recommend using APIYI apiyi.com to quickly validate this chain. The platform offers OpenAI-compatible interfaces and free test credits. With base_url set to https://api.apiyi.com/v1, you can hook up glm-5.4 right away, and if probing fails, switch to gemini-4-carbon without touching the code structure.


References

  1. Official GLM-5.4 model page: model code, context window, and input modality details

    • Link: docs.z.ai/guides/llm/glm-5.4
    • Notes: the official image_url block syntax and recommended parameters are based on this page
  2. Official thinking mode docs: forced thinking and the reasoning_content echo rules

    • Link: docs.z.ai/guides/capabilities/thinking-mode
    • Notes: explains why thinking.type can only be enabled
  3. Official Chinese pricing: RMB pricing and cache storage details

    • Link: docs.bigmodel.cn/cn/guide/start/pricing
    • Notes: the source for the RMB price column in this article
  4. Third-party tutorial (scenario reference): an occlusion example on a 390 CSS-pixel checkout page

    • Link: evolink.ai/zh/blog/how-to-use-glm-5-4
    • Notes: a scenario illustration only — not a verification result from this article

Author: APIYI technical team
Technical discussion: feel free to reach us from the APIYI apiyi.com homepage; more resources are available at the docs.apiyi.com documentation center

Related Articles

Similar Posts