Skip to content

Commit 115b71a

Browse files
0xGhostCasperkasparasizi1claude
authored
feat: image input on chatgpt.ask.ask and gemini.ask.ask (0.43.0) (#34)
Pass `image_url` and the model looks at the picture and answers about it — JPEG, PNG, GIF, WEBP, BMP, up to 5 MB. An image ask is slower than a text one: the model uploads the picture before it starts answering, so allow 90-150 s rather than the text path's 20-70 s. Both ask responses gain `images: MediaItem[]` — the pictures the answer itself displayed, favicon-sized assets excluded. Neither endpoint will GENERATE an image. Anonymous chatgpt.com and gemini.google.com both gate image generation behind a login (their own logged-out pages say so), so `images` is only ever what the answer showed, never something the model drew. The doc comments say this outright rather than leaving a caller to discover it. `image_url` is optional and the base client already drops undefined query params, so an existing call is byte-identical on the wire. Requested in SB-001078. Claude-Session: https://claude.ai/code/session_01JdMkgmhJ1o6yc7MT3BuCvW Co-authored-by: kasparasizi1 <132673909+kasparasizi1@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent a545abb commit 115b71a

7 files changed

Lines changed: 71 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.43.0] - 2026-09-04
9+
10+
### Added
11+
12+
- **Image input on `chatgpt.ask.ask` and `gemini.ask.ask`** — pass `image_url`
13+
and the model looks at the picture and answers about it (JPEG, PNG, GIF,
14+
WEBP, BMP; up to 5 MB). An image ask is slower than a text one — allow
15+
90-150 s. Requested in SB-001078.
16+
- **`images` on both ask responses** (`MediaItem[]`) — the pictures the answer
17+
itself displayed, with favicon-sized assets excluded.
18+
19+
### Note
20+
21+
Neither endpoint will GENERATE an image. Anonymous `chatgpt.com` and
22+
`gemini.google.com` both gate image generation behind a login, so `images` is
23+
only ever what the answer showed, never something the model drew.
24+
825
## [0.42.0] - 2026-09-04
926

1027
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scrapebadger",
3-
"version": "0.42.0",
3+
"version": "0.43.0",
44
"description": "Official Node.js SDK for ScrapeBadger - Async web scraping APIs for Twitter, Google, Vinted, Reddit, and more",
55
"type": "module",
66
"main": "./dist/index.js",

src/chatgpt/ask.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export class AskClient {
4040
* @param params.prompt - The prompt to send (max 4096 characters).
4141
* @param params.country - ISO-3166 alpha-2 egress country (default: "US").
4242
* @param params.web_search - "auto", "force", or "off" (default: "auto").
43+
* @param params.image_url - Public image URL to attach; ChatGPT answers about
44+
* the picture. It will NOT generate one — anonymous chatgpt.com requires a login
45+
* for that. Allow 90-150s for an image ask.
4346
* @returns The answer, its citations, and the full retrieved search set.
4447
*
4548
* @example
@@ -61,6 +64,7 @@ export class AskClient {
6164
prompt: params.prompt,
6265
country: params.country,
6366
web_search: params.web_search,
67+
image_url: params.image_url,
6468
},
6569
});
6670
}

src/chatgpt/types.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ export interface ChatGPTAskParams {
2020
country?: string;
2121
/** Whether ChatGPT should browse (default: "auto") */
2222
web_search?: ChatGPTWebSearchMode;
23+
/**
24+
* Public http(s) URL of an image to attach. ChatGPT looks at the picture and
25+
* answers about it (JPEG/PNG/GIF/WEBP/BMP, up to 5 MB). An image ask takes
26+
* noticeably longer — allow 90-150s.
27+
*
28+
* ChatGPT will NOT generate an image: anonymous chatgpt.com gates that behind a
29+
* login.
30+
*/
31+
image_url?: string;
2332
}
2433

2534
/** Parameters for the brand-visibility endpoint. */
@@ -106,6 +115,14 @@ export interface ChatGPTSearchResult {
106115
// =============================================================================
107116

108117
/** A ChatGPT answer with its sources. */
118+
/** An image the answer itself displayed. */
119+
export interface MediaItem {
120+
/** Image URL. */
121+
url: string;
122+
/** Alt text, when one was supplied. */
123+
title?: string | null;
124+
}
125+
109126
export interface ChatGPTAskResponse {
110127
/** The prompt that was sent */
111128
prompt: string;
@@ -119,6 +136,11 @@ export interface ChatGPTAskResponse {
119136
search_results: ChatGPTSearchResult[];
120137
/** Distinct domains across the sources */
121138
source_domains: string[];
139+
/**
140+
* Images the answer displayed. Never a generated image — see
141+
* `image_url` on the params.
142+
*/
143+
images: MediaItem[];
122144
/** Whether ChatGPT ACTUALLY browsed the web */
123145
/** True when the render budget expired mid-answer; `answer` is partial. */
124146
truncated: boolean;

src/gemini/ask.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export class AskClient {
3838
* @param params.prompt - The prompt to send (max 4096 characters).
3939
* @param params.country - ISO-3166 alpha-2 egress country (default: "US").
4040
* @param params.web_search - "auto", "force", or "off" (default: "auto").
41+
* @param params.image_url - Public image URL to attach; Gemini answers about
42+
* the picture. It will NOT generate one — anonymous gemini.google.com requires a login
43+
* for that. Allow 90-150s for an image ask.
4144
* @returns The answer, its citations, and the full retrieved search set.
4245
*
4346
* @example
@@ -59,6 +62,7 @@ export class AskClient {
5962
prompt: params.prompt,
6063
country: params.country,
6164
web_search: params.web_search,
65+
image_url: params.image_url,
6266
},
6367
});
6468
}

src/gemini/types.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ export interface GeminiAskParams {
2020
country?: string;
2121
/** Whether Gemini should ground with web search (default: "auto") */
2222
web_search?: GeminiWebSearchMode;
23+
/**
24+
* Public http(s) URL of an image to attach. Gemini looks at the picture and
25+
* answers about it (JPEG/PNG/GIF/WEBP/BMP, up to 5 MB). An image ask takes
26+
* noticeably longer — allow 90-150s.
27+
*
28+
* Gemini will NOT generate an image: anonymous gemini.google.com gates that behind a
29+
* login.
30+
*/
31+
image_url?: string;
2332
}
2433

2534
/** Parameters for the brand-visibility endpoint. */
@@ -90,6 +99,14 @@ export interface GeminiSearchResult {
9099
// =============================================================================
91100

92101
/** A Gemini answer with its sources. */
102+
/** An image the answer itself displayed. */
103+
export interface MediaItem {
104+
/** Image URL. */
105+
url: string;
106+
/** Alt text, when one was supplied. */
107+
title?: string | null;
108+
}
109+
93110
export interface GeminiAskResponse {
94111
/** The prompt that was sent */
95112
prompt: string;
@@ -103,6 +120,11 @@ export interface GeminiAskResponse {
103120
search_results: GeminiSearchResult[];
104121
/** Distinct domains across the sources */
105122
source_domains: string[];
123+
/**
124+
* Images the answer displayed. Never a generated image — see
125+
* `image_url` on the params.
126+
*/
127+
images: MediaItem[];
106128
/** True when the render budget expired mid-answer; `answer` is partial. */
107129
truncated: boolean;
108130
/** Whether Gemini ACTUALLY grounded the answer with a web search */

src/internal/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
*
77
* @internal
88
*/
9-
export const SDK_VERSION = "0.42.0";
9+
export const SDK_VERSION = "0.43.0";

0 commit comments

Comments
 (0)