@search1api/client 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -2
- package/dist/client.d.ts +12 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/generated.d.ts +328 -8
- package/dist/generated.d.ts.map +1 -1
- package/dist/index.cjs +36 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +36 -1
- package/dist/index.js.map +2 -2
- package/dist/types.d.ts +62 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,12 +32,39 @@ for (const result of response.results) {
|
|
|
32
32
|
|
|
33
33
|
The constructor reads `SEARCH1API_API_KEY` when `apiKey` is omitted.
|
|
34
34
|
|
|
35
|
+
`searchService` selects one engine (`google` by default), for example `bing`,
|
|
36
|
+
`bingcn`, `yandex`, `reddit`, `github`, `arxiv`, `wikipedia`, or `grokipedia`.
|
|
37
|
+
`page` requests a later results page on engines with native pagination
|
|
38
|
+
(`bing`, `bingcn`, `baidu`, `grokipedia`). Results carry `published_date` when the source
|
|
39
|
+
exposes one.
|
|
40
|
+
|
|
35
41
|
CommonJS projects can load the same client with `require`:
|
|
36
42
|
|
|
37
43
|
```js
|
|
38
44
|
const { Search1API } = require('@search1api/client');
|
|
39
45
|
```
|
|
40
46
|
|
|
47
|
+
## Ask
|
|
48
|
+
|
|
49
|
+
`ask` sends a natural-language request and lets Search1API choose the engines
|
|
50
|
+
and time window. It returns at most 10 results ranked by relevance, and
|
|
51
|
+
`intent` reports what was searched:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
const answer = await client.ask(
|
|
55
|
+
'What are developers saying about Bun 1.3 this month?'
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
console.log(answer.intent.sources, answer.intent.time_range);
|
|
59
|
+
for (const result of answer.results) {
|
|
60
|
+
console.log(result.relevance, result.source, result.title, result.link);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
A completed request costs 5 credits. Ask is not available with pay-per-request
|
|
65
|
+
payments, and its default timeout is 45 seconds. Use `search` when you already
|
|
66
|
+
know which engine and keywords you want.
|
|
67
|
+
|
|
41
68
|
## Deepcrawl
|
|
42
69
|
|
|
43
70
|
`deepcrawl` starts a task and waits for it to finish:
|
|
@@ -71,10 +98,22 @@ console.log(screenshot.contentType, screenshot.requestId);
|
|
|
71
98
|
The client also provides `news`, `crawl`, `sitemap`, `trending`, `extract`,
|
|
72
99
|
`usage`, and their batch variants where the HTTP API supports them.
|
|
73
100
|
|
|
101
|
+
`feedback` reports a Search1API problem, missing capability, or confusing
|
|
102
|
+
documentation. It is free and is never retried automatically, because a retry
|
|
103
|
+
could file a duplicate report. Do not include credentials or personal data:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
await client.feedback('Results for this query have no publication dates', {
|
|
107
|
+
category: 'feature_request',
|
|
108
|
+
requestId: 'the x-search1api-request-id of the original request',
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
74
112
|
Requests time out after 30 seconds and retry `429` and transient `5xx`
|
|
75
113
|
responses twice by default. Authentication, payment, and validation errors are
|
|
76
|
-
never retried. Deepcrawl task creation
|
|
77
|
-
|
|
114
|
+
never retried. Deepcrawl task creation and feedback are not retried
|
|
115
|
+
automatically because they are not idempotent. Configure this with `timeoutMs`
|
|
116
|
+
and `maxRetries`.
|
|
78
117
|
|
|
79
118
|
## Development
|
|
80
119
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BatchResponse, CrawlOptions, CrawlRequest, CrawlResponse, DeepcrawlAcceptedResponse, DeepcrawlOptions, DeepcrawlStatusResponse, ExtractOptions, ExtractResponse, HealthResponse, JsonValue, NewsOptions, NewsRequest, NewsResponse, RequestOptions, Search1APIOptions, SearchOptions, SearchRequest, SearchResponse, ScreenshotOptions, ScreenshotResponse, SitemapOptions, SitemapResponse, TimeRange, TrendingOptions, TrendingResponse, UsageResponse, WaitForDeepcrawlOptions } from './types.js';
|
|
1
|
+
import type { AskResponse, BatchResponse, CrawlOptions, CrawlRequest, CrawlResponse, DeepcrawlAcceptedResponse, DeepcrawlOptions, DeepcrawlStatusResponse, ExtractOptions, ExtractResponse, FeedbackOptions, FeedbackResponse, HealthResponse, JsonValue, NewsOptions, NewsRequest, NewsResponse, RequestOptions, Search1APIOptions, SearchOptions, SearchRequest, SearchResponse, ScreenshotOptions, ScreenshotResponse, SitemapOptions, SitemapResponse, TimeRange, TrendingOptions, TrendingResponse, UsageResponse, WaitForDeepcrawlOptions } from './types.js';
|
|
2
2
|
export declare class Search1API {
|
|
3
3
|
readonly apiKey: string;
|
|
4
4
|
readonly baseUrl: string;
|
|
@@ -12,6 +12,12 @@ export declare class Search1API {
|
|
|
12
12
|
searchBatch(requests: SearchRequest[], requestOptions?: RequestOptions): Promise<BatchResponse<SearchResponse>>;
|
|
13
13
|
news(query: string, options?: NewsOptions, requestOptions?: RequestOptions): Promise<NewsResponse>;
|
|
14
14
|
newsBatch(requests: NewsRequest[], requestOptions?: RequestOptions): Promise<BatchResponse<NewsResponse>>;
|
|
15
|
+
/**
|
|
16
|
+
* Agentic search: a decision model picks the engines and time window from a
|
|
17
|
+
* natural-language query and returns only relevant results. 5 credits per
|
|
18
|
+
* completed request; requires an API key or OAuth token.
|
|
19
|
+
*/
|
|
20
|
+
ask(query: string, requestOptions?: RequestOptions): Promise<AskResponse>;
|
|
15
21
|
crawl(url: string, options?: CrawlOptions, requestOptions?: RequestOptions): Promise<CrawlResponse>;
|
|
16
22
|
crawlBatch(requests: CrawlRequest[], requestOptions?: RequestOptions): Promise<CrawlResponse[]>;
|
|
17
23
|
screenshot(url: string, options?: ScreenshotOptions, requestOptions?: RequestOptions): Promise<ScreenshotResponse>;
|
|
@@ -24,6 +30,11 @@ export declare class Search1API {
|
|
|
24
30
|
deepcrawl(url: string, options?: DeepcrawlOptions, waitOptions?: WaitForDeepcrawlOptions, requestOptions?: RequestOptions): Promise<DeepcrawlStatusResponse>;
|
|
25
31
|
usage(period?: TimeRange, requestOptions?: RequestOptions): Promise<UsageResponse>;
|
|
26
32
|
health(requestOptions?: RequestOptions): Promise<HealthResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Report a Search1API problem, missing capability, or confusing docs. Free.
|
|
35
|
+
* Never include credentials or personal data in the report.
|
|
36
|
+
*/
|
|
37
|
+
feedback(message: string, options?: FeedbackOptions, requestOptions?: RequestOptions): Promise<FeedbackResponse>;
|
|
27
38
|
private requestJson;
|
|
28
39
|
private request;
|
|
29
40
|
private fetchOnce;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,cAAc,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACxB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa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E;;;OAGG;IACG,QAAQ,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,eAAoB,EAC7B,cAAc,GAAE,cAAmB,GAClC,OAAO,CAAC,gBAAgB,CAAC;YAmBd,WAAW;YAgBX,OAAO;YA+CP,SAAS;IAoDvB,OAAO,CAAC,UAAU;CAInB"}
|
package/dist/generated.d.ts
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
* Do not make direct changes to the file.
|
|
4
4
|
*/
|
|
5
5
|
export interface paths {
|
|
6
|
+
"/feedback": {
|
|
7
|
+
parameters: {
|
|
8
|
+
query?: never;
|
|
9
|
+
header?: never;
|
|
10
|
+
path?: never;
|
|
11
|
+
cookie?: never;
|
|
12
|
+
};
|
|
13
|
+
get?: never;
|
|
14
|
+
put?: never;
|
|
15
|
+
/**
|
|
16
|
+
* Report a Search1API problem or feature request
|
|
17
|
+
* @description Report a Search1API problem, missing capability, or confusing documentation encountered during a task. Only message is required. Optional request_id refers to the original problem request. Do not include credentials, personal data, or private user content. Reports are stored in Agentback and linked to an opaque account reference. Do not report every empty result or retry the same report automatically; feedback should not block the main task. Returns 201 only after storage succeeds. Maximum JSON body size: 16 KiB. Limited to 10 submissions per account per minute at a Cloudflare location. Free to call.
|
|
18
|
+
*/
|
|
19
|
+
post: operations["feedback"];
|
|
20
|
+
delete?: never;
|
|
21
|
+
options?: never;
|
|
22
|
+
head?: never;
|
|
23
|
+
patch?: never;
|
|
24
|
+
trace?: never;
|
|
25
|
+
};
|
|
6
26
|
"/screenshot": {
|
|
7
27
|
parameters: {
|
|
8
28
|
query?: never;
|
|
@@ -34,7 +54,7 @@ export interface paths {
|
|
|
34
54
|
put?: never;
|
|
35
55
|
/**
|
|
36
56
|
* Search the web using multiple search engines
|
|
37
|
-
* @description Search the live public web when the answer depends on current information, sources, or research a model's training data cannot cover. Returns ranked results with id, title, URL, and
|
|
57
|
+
* @description Search the live public web when the answer depends on current information, sources, or research a model's training data cannot cover. Returns ranked results with id, title, URL, snippet, and `published_date` (ISO 8601, when the engine exposes one) across 13+ engines, with optional images. Set `crawl_results` to pull the top N result pages in the same call — each crawled page is billed as an additional crawl — or pass a result URL to POST /crawl separately. Costs 1 credit per request.
|
|
38
58
|
*/
|
|
39
59
|
post: operations["search"];
|
|
40
60
|
delete?: never;
|
|
@@ -54,7 +74,7 @@ export interface paths {
|
|
|
54
74
|
put?: never;
|
|
55
75
|
/**
|
|
56
76
|
* Search news articles across multiple sources
|
|
57
|
-
* @description Search recent news when the question is about events, announcements, or coverage rather than reference material. Returns articles from verified publishers with title, URL, snippet, and optional full page content, filterable by site, language, and time range. For questions that are not time-sensitive, prefer POST /search. Costs 1 credit per request.
|
|
77
|
+
* @description Search recent news when the question is about events, announcements, or coverage rather than reference material. Returns articles from verified publishers with title, URL, snippet, `published_date` (ISO 8601, when known), and optional full page content, filterable by site, language, and time range. For questions that are not time-sensitive, prefer POST /search. Costs 1 credit per request.
|
|
58
78
|
*/
|
|
59
79
|
post: operations["news"];
|
|
60
80
|
delete?: never;
|
|
@@ -63,6 +83,26 @@ export interface paths {
|
|
|
63
83
|
patch?: never;
|
|
64
84
|
trace?: never;
|
|
65
85
|
};
|
|
86
|
+
"/ask": {
|
|
87
|
+
parameters: {
|
|
88
|
+
query?: never;
|
|
89
|
+
header?: never;
|
|
90
|
+
path?: never;
|
|
91
|
+
cookie?: never;
|
|
92
|
+
};
|
|
93
|
+
get?: never;
|
|
94
|
+
put?: never;
|
|
95
|
+
/**
|
|
96
|
+
* Search the engines a natural-language request calls for
|
|
97
|
+
* @description Agentic search. Describe what you are looking for in plain language and let a decision model (currently TypeSafe Jev) decide where to look. It picks up to five engines (web search, Hacker News, Reddit, GitHub, X, arXiv, Wikipedia, IMDb, WeChat, YouTube), rewrites the request into search keywords, infers a publication window from phrases such as "this week", searches the engines in parallel, and returns only the results judged relevant, merged and ranked, so agents read fewer off-topic results. The request takes only `query`; engines, keywords, and the window are always chosen by the model, and the response reports them in `intent`. Use POST /search instead when you already know the engine and keywords and want its raw ranking. Costs 5 credits per request.
|
|
98
|
+
*/
|
|
99
|
+
post: operations["ask"];
|
|
100
|
+
delete?: never;
|
|
101
|
+
options?: never;
|
|
102
|
+
head?: never;
|
|
103
|
+
patch?: never;
|
|
104
|
+
trace?: never;
|
|
105
|
+
};
|
|
66
106
|
"/crawl": {
|
|
67
107
|
parameters: {
|
|
68
108
|
query?: never;
|
|
@@ -74,7 +114,7 @@ export interface paths {
|
|
|
74
114
|
put?: never;
|
|
75
115
|
/**
|
|
76
116
|
* Crawl a URL and extract its content
|
|
77
|
-
* @description Fetch one public URL and return its readable title and body as clean text, with navigation, boilerplate, and scripts stripped. Use it on a URL the user supplied or one returned by POST /search. To ingest a whole site rather than a single page, use POST /deepcrawl. Costs 1 credit per request.
|
|
117
|
+
* @description Fetch one public URL and return its readable title and body as clean text, with navigation, boilerplate, and scripts stripped. Use it on a URL the user supplied or one returned by POST /search. To ingest a whole site rather than a single page, use POST /deepcrawl. Send an array of request objects to crawl several URLs in one call: the response is an array containing only the URLs that succeeded, in no guaranteed order, so match items back to your input by `crawlParameters.url`; failed URLs are omitted and not charged. `enable_fallback` is accepted as a snake_case alias of `enableFallback`. Costs 1 credit per request.
|
|
78
118
|
*/
|
|
79
119
|
post: operations["crawl"];
|
|
80
120
|
delete?: never;
|
|
@@ -94,7 +134,7 @@ export interface paths {
|
|
|
94
134
|
put?: never;
|
|
95
135
|
/**
|
|
96
136
|
* Extract sitemap URLs from a website
|
|
97
|
-
* @description Discover the public URLs of a site when you need to know which pages exist before fetching any of them — scoping a crawl, auditing coverage, or locating a section.
|
|
137
|
+
* @description Discover the public URLs of a site when you need to know which pages exist before fetching any of them — scoping a crawl, auditing coverage, or locating a section. With the default `type: "sitemap"` this reads the site's own sitemap: `Sitemap:` directives in robots.txt first, then the conventional paths, following sitemap index files and gzipped sitemaps, and returns the URLs it declares for the requested host. A site that publishes no sitemap falls back to the links found on the given page. Use `type: "all"` to skip the sitemap and get every link on that one page instead, including links to other hosts. Neither mode fetches page content. Costs 1 credit per request.
|
|
98
138
|
*/
|
|
99
139
|
post: operations["sitemap"];
|
|
100
140
|
delete?: never;
|
|
@@ -227,7 +267,7 @@ export interface paths {
|
|
|
227
267
|
export type webhooks = Record<string, never>;
|
|
228
268
|
export interface components {
|
|
229
269
|
schemas: {
|
|
230
|
-
/** @description Search1API error. Payment challenges may use RFC 9457 problem detail fields. */
|
|
270
|
+
/** @description Search1API error. Every JSON error carries `ok: false`, `error` (a short status-derived label) and `message` (human-readable detail); validation failures add `errors`. Payment challenges may use RFC 9457 problem detail fields. */
|
|
231
271
|
ApiError: {
|
|
232
272
|
/** @enum {boolean} */
|
|
233
273
|
ok?: false;
|
|
@@ -249,9 +289,11 @@ export interface components {
|
|
|
249
289
|
SearchParameters: {
|
|
250
290
|
query: string;
|
|
251
291
|
/** @enum {string} */
|
|
252
|
-
search_service?: "google" | "bing" | "duckduckgo" | "yahoo" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "" | "
|
|
292
|
+
search_service?: "google" | "bing" | "bingcn" | "duckduckgo" | "yahoo" | "yandex" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "grokipedia" | "" | "baidu" | "360" | "quark";
|
|
253
293
|
/** @default 5 */
|
|
254
294
|
max_results: number;
|
|
295
|
+
/** @default 1 */
|
|
296
|
+
page: number;
|
|
255
297
|
/** @default 0 */
|
|
256
298
|
crawl_results: number;
|
|
257
299
|
/** @default false */
|
|
@@ -318,6 +360,29 @@ export interface components {
|
|
|
318
360
|
link: string;
|
|
319
361
|
snippet: string;
|
|
320
362
|
content?: string;
|
|
363
|
+
/**
|
|
364
|
+
* @description When the page was published, as ISO 8601: `YYYY-MM-DD` when only the day is known (web search engines), or `YYYY-MM-DDTHH:MM:SSZ` in UTC when the source carries a time (x, reddit, github, arxiv, youtube, bilibili, wechat, news feeds). Omitted when the source exposes no date, so treat it as optional per result.
|
|
365
|
+
* @example 2026-09-03
|
|
366
|
+
*/
|
|
367
|
+
published_date?: string;
|
|
368
|
+
/**
|
|
369
|
+
* @description What a `github` result is: a repository, an issue, a pull request, or a discussion. Only present for `search_service: "github"`.
|
|
370
|
+
* @enum {string}
|
|
371
|
+
*/
|
|
372
|
+
kind?: "repo" | "issue" | "pr" | "discussion";
|
|
373
|
+
/** @description Stargazer count of a `github` repository result (`kind: "repo"`). */
|
|
374
|
+
stars?: number;
|
|
375
|
+
/** @description Primary language of a `github` repository result (`kind: "repo"`). Omitted when GitHub reports none. */
|
|
376
|
+
language?: string;
|
|
377
|
+
/** @description Comment count on a `github` issue, pull request or discussion, or on a `hackernews` thread (POST /news). */
|
|
378
|
+
num_comments?: number;
|
|
379
|
+
/**
|
|
380
|
+
* Format: uri
|
|
381
|
+
* @description POST /news with `search_service: "hackernews"` only: the submitted article. `link` is the Hacker News discussion thread; `story_url` is empty for Ask HN / Show HN text posts.
|
|
382
|
+
*/
|
|
383
|
+
story_url?: string;
|
|
384
|
+
/** @description POST /news with `search_service: "hackernews"` only: upvotes on the thread. */
|
|
385
|
+
points?: number;
|
|
321
386
|
} & {
|
|
322
387
|
[key: string]: unknown;
|
|
323
388
|
};
|
|
@@ -365,6 +430,44 @@ export interface components {
|
|
|
365
430
|
totalCost: number;
|
|
366
431
|
};
|
|
367
432
|
};
|
|
433
|
+
AskResult: {
|
|
434
|
+
title: string;
|
|
435
|
+
/** Format: uri */
|
|
436
|
+
link: string;
|
|
437
|
+
snippet: string;
|
|
438
|
+
/**
|
|
439
|
+
* @description When the page was published, as ISO 8601 (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`). Omitted when the engine exposes no date.
|
|
440
|
+
* @example 2026-09-03
|
|
441
|
+
*/
|
|
442
|
+
published_date?: string;
|
|
443
|
+
/** @description Engine that returned the result. */
|
|
444
|
+
source: string;
|
|
445
|
+
/** @description How likely the result is to be about the query, two decimals. Only results scoring at least 0.5 are returned. */
|
|
446
|
+
relevance: number;
|
|
447
|
+
};
|
|
448
|
+
AskResponse: {
|
|
449
|
+
/** @description The query as sent. */
|
|
450
|
+
query: string;
|
|
451
|
+
/** @description How the request was interpreted and searched. */
|
|
452
|
+
intent: {
|
|
453
|
+
/** @description Keywords sent to the engines, with platform and time phrases removed. */
|
|
454
|
+
search_query: string;
|
|
455
|
+
/** @description Engines searched. */
|
|
456
|
+
sources: string[];
|
|
457
|
+
/**
|
|
458
|
+
* @description Publication window applied, or null for none.
|
|
459
|
+
* @enum {string|null}
|
|
460
|
+
*/
|
|
461
|
+
time_range: "day" | "week" | "month" | "year" | null;
|
|
462
|
+
};
|
|
463
|
+
/** @description Relevant results from every engine, best first, with duplicates merged. May be empty. */
|
|
464
|
+
results: components["schemas"]["AskResult"][];
|
|
465
|
+
/** @description Engines that failed while others completed. The request is still charged. */
|
|
466
|
+
errors: {
|
|
467
|
+
source: string;
|
|
468
|
+
message: string;
|
|
469
|
+
}[];
|
|
470
|
+
};
|
|
368
471
|
CrawlResult: {
|
|
369
472
|
title: string;
|
|
370
473
|
/** Format: uri */
|
|
@@ -436,6 +539,11 @@ export interface components {
|
|
|
436
539
|
credential_type: "api_key" | "oauth";
|
|
437
540
|
client_id?: string | null;
|
|
438
541
|
};
|
|
542
|
+
FeedbackResponse: {
|
|
543
|
+
id: string;
|
|
544
|
+
/** @enum {string} */
|
|
545
|
+
status: "new";
|
|
546
|
+
};
|
|
439
547
|
};
|
|
440
548
|
responses: never;
|
|
441
549
|
parameters: never;
|
|
@@ -445,6 +553,115 @@ export interface components {
|
|
|
445
553
|
}
|
|
446
554
|
export type $defs = Record<string, never>;
|
|
447
555
|
export interface operations {
|
|
556
|
+
feedback: {
|
|
557
|
+
parameters: {
|
|
558
|
+
query?: never;
|
|
559
|
+
header?: never;
|
|
560
|
+
path?: never;
|
|
561
|
+
cookie?: never;
|
|
562
|
+
};
|
|
563
|
+
requestBody: {
|
|
564
|
+
content: {
|
|
565
|
+
"application/json": {
|
|
566
|
+
message: string;
|
|
567
|
+
intent?: string;
|
|
568
|
+
/**
|
|
569
|
+
* @default other
|
|
570
|
+
* @enum {string}
|
|
571
|
+
*/
|
|
572
|
+
category?: "bug" | "feature_request" | "docs" | "other";
|
|
573
|
+
request_id?: string;
|
|
574
|
+
agent?: {
|
|
575
|
+
name?: string;
|
|
576
|
+
model?: string;
|
|
577
|
+
};
|
|
578
|
+
};
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
responses: {
|
|
582
|
+
/** @description Successful response */
|
|
583
|
+
201: {
|
|
584
|
+
headers: {
|
|
585
|
+
[name: string]: unknown;
|
|
586
|
+
};
|
|
587
|
+
content: {
|
|
588
|
+
"application/json": components["schemas"]["FeedbackResponse"];
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
/** @description Bad Request */
|
|
592
|
+
400: {
|
|
593
|
+
headers: {
|
|
594
|
+
[name: string]: unknown;
|
|
595
|
+
};
|
|
596
|
+
content: {
|
|
597
|
+
"application/json": components["schemas"]["ApiError"];
|
|
598
|
+
};
|
|
599
|
+
};
|
|
600
|
+
/** @description Unauthorized */
|
|
601
|
+
401: {
|
|
602
|
+
headers: {
|
|
603
|
+
[name: string]: unknown;
|
|
604
|
+
};
|
|
605
|
+
content: {
|
|
606
|
+
"application/json": components["schemas"]["ApiError"];
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
/** @description Forbidden */
|
|
610
|
+
403: {
|
|
611
|
+
headers: {
|
|
612
|
+
[name: string]: unknown;
|
|
613
|
+
};
|
|
614
|
+
content: {
|
|
615
|
+
"application/json": components["schemas"]["ApiError"];
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
/** @description Payload Too Large */
|
|
619
|
+
413: {
|
|
620
|
+
headers: {
|
|
621
|
+
[name: string]: unknown;
|
|
622
|
+
};
|
|
623
|
+
content: {
|
|
624
|
+
"application/json": components["schemas"]["ApiError"];
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
/** @description Unsupported Media Type */
|
|
628
|
+
415: {
|
|
629
|
+
headers: {
|
|
630
|
+
[name: string]: unknown;
|
|
631
|
+
};
|
|
632
|
+
content: {
|
|
633
|
+
"application/json": components["schemas"]["ApiError"];
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
/** @description Too Many Requests */
|
|
637
|
+
429: {
|
|
638
|
+
headers: {
|
|
639
|
+
[name: string]: unknown;
|
|
640
|
+
};
|
|
641
|
+
content: {
|
|
642
|
+
"application/json": components["schemas"]["ApiError"];
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
/** @description Internal Server Error */
|
|
646
|
+
500: {
|
|
647
|
+
headers: {
|
|
648
|
+
[name: string]: unknown;
|
|
649
|
+
};
|
|
650
|
+
content: {
|
|
651
|
+
"application/json": components["schemas"]["ApiError"];
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
/** @description Service Unavailable */
|
|
655
|
+
503: {
|
|
656
|
+
headers: {
|
|
657
|
+
[name: string]: unknown;
|
|
658
|
+
};
|
|
659
|
+
content: {
|
|
660
|
+
"application/json": components["schemas"]["ApiError"];
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
};
|
|
664
|
+
};
|
|
448
665
|
screenshot: {
|
|
449
666
|
parameters: {
|
|
450
667
|
query?: never;
|
|
@@ -622,9 +839,11 @@ export interface operations {
|
|
|
622
839
|
"application/json": {
|
|
623
840
|
query: string;
|
|
624
841
|
/** @enum {string} */
|
|
625
|
-
search_service?: "google" | "bing" | "duckduckgo" | "yahoo" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "" | "
|
|
842
|
+
search_service?: "google" | "bing" | "bingcn" | "duckduckgo" | "yahoo" | "yandex" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "grokipedia" | "" | "baidu" | "360" | "quark";
|
|
626
843
|
/** @default 5 */
|
|
627
844
|
max_results?: number;
|
|
845
|
+
/** @default 1 */
|
|
846
|
+
page?: number;
|
|
628
847
|
/** @default 0 */
|
|
629
848
|
crawl_results?: number;
|
|
630
849
|
/** @default false */
|
|
@@ -639,9 +858,11 @@ export interface operations {
|
|
|
639
858
|
} | {
|
|
640
859
|
query: string;
|
|
641
860
|
/** @enum {string} */
|
|
642
|
-
search_service?: "google" | "bing" | "duckduckgo" | "yahoo" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "" | "
|
|
861
|
+
search_service?: "google" | "bing" | "bingcn" | "duckduckgo" | "yahoo" | "yandex" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "grokipedia" | "" | "baidu" | "360" | "quark";
|
|
643
862
|
/** @default 5 */
|
|
644
863
|
max_results?: number;
|
|
864
|
+
/** @default 1 */
|
|
865
|
+
page?: number;
|
|
645
866
|
/** @default 0 */
|
|
646
867
|
crawl_results?: number;
|
|
647
868
|
/** @default false */
|
|
@@ -852,6 +1073,87 @@ export interface operations {
|
|
|
852
1073
|
};
|
|
853
1074
|
};
|
|
854
1075
|
};
|
|
1076
|
+
ask: {
|
|
1077
|
+
parameters: {
|
|
1078
|
+
query?: never;
|
|
1079
|
+
header?: never;
|
|
1080
|
+
path?: never;
|
|
1081
|
+
cookie?: never;
|
|
1082
|
+
};
|
|
1083
|
+
requestBody: {
|
|
1084
|
+
content: {
|
|
1085
|
+
"application/json": {
|
|
1086
|
+
/** @description What you are looking for, in natural language. Platform hints ("on Reddit", "papers") and time hints ("this week") steer engine and time-range selection. */
|
|
1087
|
+
query: string;
|
|
1088
|
+
};
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
responses: {
|
|
1092
|
+
/** @description Successful response */
|
|
1093
|
+
200: {
|
|
1094
|
+
headers: {
|
|
1095
|
+
[name: string]: unknown;
|
|
1096
|
+
};
|
|
1097
|
+
content: {
|
|
1098
|
+
"application/json": components["schemas"]["AskResponse"];
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1101
|
+
/** @description Bad Request */
|
|
1102
|
+
400: {
|
|
1103
|
+
headers: {
|
|
1104
|
+
[name: string]: unknown;
|
|
1105
|
+
};
|
|
1106
|
+
content: {
|
|
1107
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1108
|
+
};
|
|
1109
|
+
};
|
|
1110
|
+
/** @description Unauthorized */
|
|
1111
|
+
401: {
|
|
1112
|
+
headers: {
|
|
1113
|
+
[name: string]: unknown;
|
|
1114
|
+
};
|
|
1115
|
+
content: {
|
|
1116
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1117
|
+
};
|
|
1118
|
+
};
|
|
1119
|
+
/** @description Payment Required */
|
|
1120
|
+
402: {
|
|
1121
|
+
headers: {
|
|
1122
|
+
[name: string]: unknown;
|
|
1123
|
+
};
|
|
1124
|
+
content: {
|
|
1125
|
+
"application/problem+json": components["schemas"]["ApiError"];
|
|
1126
|
+
};
|
|
1127
|
+
};
|
|
1128
|
+
/** @description Too Many Requests */
|
|
1129
|
+
429: {
|
|
1130
|
+
headers: {
|
|
1131
|
+
[name: string]: unknown;
|
|
1132
|
+
};
|
|
1133
|
+
content: {
|
|
1134
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1135
|
+
};
|
|
1136
|
+
};
|
|
1137
|
+
/** @description Internal Server Error */
|
|
1138
|
+
500: {
|
|
1139
|
+
headers: {
|
|
1140
|
+
[name: string]: unknown;
|
|
1141
|
+
};
|
|
1142
|
+
content: {
|
|
1143
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1144
|
+
};
|
|
1145
|
+
};
|
|
1146
|
+
/** @description Bad Gateway */
|
|
1147
|
+
502: {
|
|
1148
|
+
headers: {
|
|
1149
|
+
[name: string]: unknown;
|
|
1150
|
+
};
|
|
1151
|
+
content: {
|
|
1152
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1153
|
+
};
|
|
1154
|
+
};
|
|
1155
|
+
};
|
|
1156
|
+
};
|
|
855
1157
|
crawl: {
|
|
856
1158
|
parameters: {
|
|
857
1159
|
query?: never;
|
|
@@ -911,6 +1213,24 @@ export interface operations {
|
|
|
911
1213
|
"application/problem+json": components["schemas"]["ApiError"];
|
|
912
1214
|
};
|
|
913
1215
|
};
|
|
1216
|
+
/** @description Not Found */
|
|
1217
|
+
404: {
|
|
1218
|
+
headers: {
|
|
1219
|
+
[name: string]: unknown;
|
|
1220
|
+
};
|
|
1221
|
+
content: {
|
|
1222
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1223
|
+
};
|
|
1224
|
+
};
|
|
1225
|
+
/** @description Gone */
|
|
1226
|
+
410: {
|
|
1227
|
+
headers: {
|
|
1228
|
+
[name: string]: unknown;
|
|
1229
|
+
};
|
|
1230
|
+
content: {
|
|
1231
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1232
|
+
};
|
|
1233
|
+
};
|
|
914
1234
|
/** @description Validation Error */
|
|
915
1235
|
422: {
|
|
916
1236
|
headers: {
|