@openrouter/sdk 1.3.10 → 1.3.12
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/esm/funcs/internsChat.d.ts +10 -0
- package/esm/funcs/internsChat.js +5 -21
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/byokkey.d.ts +4 -0
- package/esm/models/byokkey.js +2 -0
- package/esm/models/chatwebsearchshorthand.d.ts +8 -2
- package/esm/models/chatwebsearchshorthand.js +3 -0
- package/esm/models/createbyokkeyrequest.d.ts +5 -0
- package/esm/models/createbyokkeyrequest.js +2 -0
- package/esm/models/generationresponse.d.ts +2 -2
- package/esm/models/generationresponse.js +2 -2
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/internchatsteeredresponse.d.ts +33 -0
- package/esm/models/internchatsteeredresponse.js +28 -0
- package/esm/models/legacywebsearchservertool.d.ts +6 -0
- package/esm/models/legacywebsearchservertool.js +5 -0
- package/esm/models/operations/createinternchatcompletion.d.ts +5 -1
- package/esm/models/operations/createinternchatcompletion.js +25 -3
- package/esm/models/preview20250311websearchservertool.d.ts +6 -0
- package/esm/models/preview20250311websearchservertool.js +5 -0
- package/esm/models/previewwebsearchservertool.d.ts +6 -0
- package/esm/models/previewwebsearchservertool.js +5 -0
- package/esm/models/updatebyokkeyrequest.d.ts +5 -0
- package/esm/models/updatebyokkeyrequest.js +2 -0
- package/esm/models/websearchconfig.d.ts +8 -2
- package/esm/models/websearchconfig.js +3 -0
- package/esm/models/websearchplugin.d.ts +6 -0
- package/esm/models/websearchplugin.js +3 -0
- package/esm/models/websearchservertool.d.ts +6 -0
- package/esm/models/websearchservertool.js +5 -0
- package/esm/models/websearchservertoolconfig.d.ts +8 -2
- package/esm/models/websearchservertoolconfig.js +3 -0
- package/esm/models/xsearchoptions.d.ts +49 -0
- package/esm/models/xsearchoptions.js +51 -0
- package/esm/sdk/interns.d.ts +10 -0
- package/esm/sdk/interns.js +0 -18
- package/jsr.json +1 -1
- package/package.json +5 -5
|
@@ -28,5 +28,15 @@ import { Result } from "../types/fp.js";
|
|
|
28
28
|
*
|
|
29
29
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
30
30
|
*/
|
|
31
|
+
export declare function internsChat(client: OpenRouterCore, request: operations.CreateInternChatCompletionRequest & {
|
|
32
|
+
internChatCompletionRequest: {
|
|
33
|
+
stream?: false;
|
|
34
|
+
};
|
|
35
|
+
}, options?: RequestOptions): APIPromise<Result<operations.CreateInternChatCompletionResponse, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
36
|
+
export declare function internsChat(client: OpenRouterCore, request: operations.CreateInternChatCompletionRequest & {
|
|
37
|
+
internChatCompletionRequest: {
|
|
38
|
+
stream: true;
|
|
39
|
+
};
|
|
40
|
+
}, options?: RequestOptions): APIPromise<Result<operations.CreateInternChatCompletionResponse, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
31
41
|
export declare function internsChat(client: OpenRouterCore, request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): APIPromise<Result<operations.CreateInternChatCompletionResponse, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
32
42
|
//# sourceMappingURL=internsChat.d.ts.map
|
package/esm/funcs/internsChat.js
CHANGED
|
@@ -12,26 +12,6 @@ import { pathToFunc } from "../lib/url.js";
|
|
|
12
12
|
import * as errors from "../models/errors/index.js";
|
|
13
13
|
import * as operations from "../models/operations/index.js";
|
|
14
14
|
import { APIPromise } from "../types/async.js";
|
|
15
|
-
/**
|
|
16
|
-
* Stream a chat completion with an intern
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
|
|
20
|
-
*
|
|
21
|
-
* Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
|
|
22
|
-
*
|
|
23
|
-
* To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
|
|
24
|
-
*
|
|
25
|
-
* Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
|
|
26
|
-
*
|
|
27
|
-
* A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
|
|
28
|
-
*
|
|
29
|
-
* Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
|
|
30
|
-
*
|
|
31
|
-
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
32
|
-
*
|
|
33
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
34
|
-
*/
|
|
35
15
|
export function internsChat(client, request, options) {
|
|
36
16
|
return new APIPromise($do(client, request, options));
|
|
37
17
|
}
|
|
@@ -53,7 +33,9 @@ async function $do(client, request, options) {
|
|
|
53
33
|
const path = pathToFunc("/interns/{internId}/chat/completions")(pathParams);
|
|
54
34
|
const headers = new Headers(compactMap({
|
|
55
35
|
"Content-Type": "application/json",
|
|
56
|
-
Accept:
|
|
36
|
+
Accept: request?.internChatCompletionRequest?.stream
|
|
37
|
+
? "text/event-stream"
|
|
38
|
+
: "application/json",
|
|
57
39
|
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
58
40
|
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
59
41
|
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
@@ -112,6 +94,8 @@ async function $do(client, request, options) {
|
|
|
112
94
|
};
|
|
113
95
|
const [result] = await M.match(M.sse(200, operations.CreateInternChatCompletionResponse$inboundSchema, {
|
|
114
96
|
key: "Result",
|
|
97
|
+
}), M.json(202, operations.CreateInternChatCompletionResponse$inboundSchema, {
|
|
98
|
+
key: "Result",
|
|
115
99
|
}), M.jsonErr([400, 401, 403, 404, 408, 410, 413], errors.InternChatErrorResponse$inboundSchema), M.jsonErr([409, 429], errors.InternChatErrorResponse$inboundSchema, {
|
|
116
100
|
hdrs: true,
|
|
117
101
|
}), M.jsonErr(503, errors.InternChatErrorResponse$inboundSchema, {
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.3.
|
|
53
|
+
readonly sdkVersion: "1.3.12";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.3.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.3.12 2.914.0 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.3.
|
|
32
|
+
sdkVersion: "1.3.12",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.3.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.3.12 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
package/esm/models/byokkey.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export type BYOKKey = {
|
|
|
19
19
|
* ISO timestamp of when the credential was created.
|
|
20
20
|
*/
|
|
21
21
|
createdAt: string;
|
|
22
|
+
/**
|
|
23
|
+
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter.
|
|
24
|
+
*/
|
|
25
|
+
declaredZdr: boolean | null;
|
|
22
26
|
/**
|
|
23
27
|
* Whether this credential is currently disabled.
|
|
24
28
|
*/
|
package/esm/models/byokkey.js
CHANGED
|
@@ -12,6 +12,7 @@ export const BYOKKey$inboundSchema = z.object({
|
|
|
12
12
|
allowed_models: z.nullable(z.array(z.string())),
|
|
13
13
|
allowed_user_ids: z.nullable(z.array(z.string())),
|
|
14
14
|
created_at: z.string(),
|
|
15
|
+
declared_zdr: z.nullable(z.boolean()),
|
|
15
16
|
disabled: z.boolean(),
|
|
16
17
|
id: z.string(),
|
|
17
18
|
is_byok_only: z.boolean(),
|
|
@@ -28,6 +29,7 @@ export const BYOKKey$inboundSchema = z.object({
|
|
|
28
29
|
"allowed_models": "allowedModels",
|
|
29
30
|
"allowed_user_ids": "allowedUserIds",
|
|
30
31
|
"created_at": "createdAt",
|
|
32
|
+
"declared_zdr": "declaredZdr",
|
|
31
33
|
"is_byok_only": "isByokOnly",
|
|
32
34
|
"is_fallback": "isFallback",
|
|
33
35
|
"is_required": "isRequired",
|
|
@@ -5,6 +5,7 @@ import { WebSearchConfig, WebSearchConfig$Outbound } from "./websearchconfig.js"
|
|
|
5
5
|
import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
6
6
|
import { WebSearchMode } from "./websearchmode.js";
|
|
7
7
|
import { WebSearchUserLocationServerTool, WebSearchUserLocationServerTool$Outbound } from "./websearchuserlocationservertool.js";
|
|
8
|
+
import { XSearchOptions, XSearchOptions$Outbound } from "./xsearchoptions.js";
|
|
8
9
|
export declare const ChatWebSearchShorthandType: {
|
|
9
10
|
readonly WebSearch: "web_search";
|
|
10
11
|
readonly WebSearchPreview: "web_search_preview";
|
|
@@ -17,7 +18,7 @@ export type ChatWebSearchShorthandType = OpenEnum<typeof ChatWebSearchShorthandT
|
|
|
17
18
|
*/
|
|
18
19
|
export type ChatWebSearchShorthand = {
|
|
19
20
|
/**
|
|
20
|
-
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI,
|
|
21
|
+
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, SpaceXAI). Cannot be used with excluded_domains.
|
|
21
22
|
*/
|
|
22
23
|
allowedDomains?: Array<string> | undefined;
|
|
23
24
|
/**
|
|
@@ -25,7 +26,7 @@ export type ChatWebSearchShorthand = {
|
|
|
25
26
|
*/
|
|
26
27
|
engine?: WebSearchEngineEnum | undefined;
|
|
27
28
|
/**
|
|
28
|
-
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, OpenAI, and
|
|
29
|
+
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, OpenAI, and SpaceXAI. Cannot be used with allowed_domains.
|
|
29
30
|
*/
|
|
30
31
|
excludedDomains?: Array<string> | undefined;
|
|
31
32
|
/**
|
|
@@ -58,6 +59,10 @@ export type ChatWebSearchShorthand = {
|
|
|
58
59
|
* Approximate user location for location-biased results.
|
|
59
60
|
*/
|
|
60
61
|
userLocation?: WebSearchUserLocationServerTool | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
64
|
+
*/
|
|
65
|
+
xSearch?: XSearchOptions | undefined;
|
|
61
66
|
};
|
|
62
67
|
/** @internal */
|
|
63
68
|
export declare const ChatWebSearchShorthandType$outboundSchema: z.ZodType<string, ChatWebSearchShorthandType>;
|
|
@@ -75,6 +80,7 @@ export type ChatWebSearchShorthand$Outbound = {
|
|
|
75
80
|
search_context_size?: string | undefined;
|
|
76
81
|
type: string;
|
|
77
82
|
user_location?: WebSearchUserLocationServerTool$Outbound | undefined;
|
|
83
|
+
x_search?: XSearchOptions$Outbound | undefined;
|
|
78
84
|
};
|
|
79
85
|
/** @internal */
|
|
80
86
|
export declare const ChatWebSearchShorthand$outboundSchema: z.ZodType<ChatWebSearchShorthand$Outbound, ChatWebSearchShorthand>;
|
|
@@ -10,6 +10,7 @@ import { WebSearchConfig$outboundSchema, } from "./websearchconfig.js";
|
|
|
10
10
|
import { WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
|
|
11
11
|
import { WebSearchMode$outboundSchema, } from "./websearchmode.js";
|
|
12
12
|
import { WebSearchUserLocationServerTool$outboundSchema, } from "./websearchuserlocationservertool.js";
|
|
13
|
+
import { XSearchOptions$outboundSchema, } from "./xsearchoptions.js";
|
|
13
14
|
export const ChatWebSearchShorthandType = {
|
|
14
15
|
WebSearch: "web_search",
|
|
15
16
|
WebSearchPreview: "web_search_preview",
|
|
@@ -32,6 +33,7 @@ export const ChatWebSearchShorthand$outboundSchema = z.object({
|
|
|
32
33
|
searchContextSize: SearchQualityLevel$outboundSchema.optional(),
|
|
33
34
|
type: ChatWebSearchShorthandType$outboundSchema,
|
|
34
35
|
userLocation: WebSearchUserLocationServerTool$outboundSchema.optional(),
|
|
36
|
+
xSearch: XSearchOptions$outboundSchema.optional(),
|
|
35
37
|
}).transform((v) => {
|
|
36
38
|
return remap$(v, {
|
|
37
39
|
allowedDomains: "allowed_domains",
|
|
@@ -42,6 +44,7 @@ export const ChatWebSearchShorthand$outboundSchema = z.object({
|
|
|
42
44
|
maxUses: "max_uses",
|
|
43
45
|
searchContextSize: "search_context_size",
|
|
44
46
|
userLocation: "user_location",
|
|
47
|
+
xSearch: "x_search",
|
|
45
48
|
});
|
|
46
49
|
});
|
|
47
50
|
export function chatWebSearchShorthandToJSON(chatWebSearchShorthand) {
|
|
@@ -13,6 +13,10 @@ export type CreateBYOKKeyRequest = {
|
|
|
13
13
|
* Optional allowlist of user IDs that may use this credential. `null` means no restriction.
|
|
14
14
|
*/
|
|
15
15
|
allowedUserIds?: Array<string> | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`.
|
|
18
|
+
*/
|
|
19
|
+
declaredZdr?: boolean | null | undefined;
|
|
16
20
|
/**
|
|
17
21
|
* Whether this credential should be created in a disabled state.
|
|
18
22
|
*/
|
|
@@ -51,6 +55,7 @@ export type CreateBYOKKeyRequest$Outbound = {
|
|
|
51
55
|
allowed_api_key_hashes?: Array<string> | null | undefined;
|
|
52
56
|
allowed_models?: Array<string> | null | undefined;
|
|
53
57
|
allowed_user_ids?: Array<string> | null | undefined;
|
|
58
|
+
declared_zdr?: boolean | null | undefined;
|
|
54
59
|
disabled?: boolean | undefined;
|
|
55
60
|
is_byok_only?: boolean | undefined;
|
|
56
61
|
is_fallback?: boolean | undefined;
|
|
@@ -10,6 +10,7 @@ export const CreateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
10
10
|
allowedApiKeyHashes: z.nullable(z.array(z.string())).optional(),
|
|
11
11
|
allowedModels: z.nullable(z.array(z.string())).optional(),
|
|
12
12
|
allowedUserIds: z.nullable(z.array(z.string())).optional(),
|
|
13
|
+
declaredZdr: z.nullable(z.boolean()).optional(),
|
|
13
14
|
disabled: z.boolean().optional(),
|
|
14
15
|
isByokOnly: z.boolean().optional(),
|
|
15
16
|
isFallback: z.boolean().optional(),
|
|
@@ -23,6 +24,7 @@ export const CreateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
23
24
|
allowedApiKeyHashes: "allowed_api_key_hashes",
|
|
24
25
|
allowedModels: "allowed_models",
|
|
25
26
|
allowedUserIds: "allowed_user_ids",
|
|
27
|
+
declaredZdr: "declared_zdr",
|
|
26
28
|
isByokOnly: "is_byok_only",
|
|
27
29
|
isFallback: "is_fallback",
|
|
28
30
|
isRequired: "is_required",
|
|
@@ -10,11 +10,11 @@ export declare const ApiType: {
|
|
|
10
10
|
readonly Completions: "completions";
|
|
11
11
|
readonly Embeddings: "embeddings";
|
|
12
12
|
readonly Rerank: "rerank";
|
|
13
|
+
readonly Decisions: "decisions";
|
|
14
|
+
readonly Video: "video";
|
|
13
15
|
readonly TTS: "tts";
|
|
14
16
|
readonly STT: "stt";
|
|
15
|
-
readonly Video: "video";
|
|
16
17
|
readonly Image: "image";
|
|
17
|
-
readonly Decisions: "decisions";
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Type of API used for the generation
|
|
@@ -14,11 +14,11 @@ export const ApiType = {
|
|
|
14
14
|
Completions: "completions",
|
|
15
15
|
Embeddings: "embeddings",
|
|
16
16
|
Rerank: "rerank",
|
|
17
|
+
Decisions: "decisions",
|
|
18
|
+
Video: "video",
|
|
17
19
|
TTS: "tts",
|
|
18
20
|
STT: "stt",
|
|
19
|
-
Video: "video",
|
|
20
21
|
Image: "image",
|
|
21
|
-
Decisions: "decisions",
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* The data region this generation was routed through: 'global', 'europe', or 'us'.
|
package/esm/models/index.d.ts
CHANGED
|
@@ -331,6 +331,7 @@ export * from "./internchaterrormetadata.js";
|
|
|
331
331
|
export * from "./internchatmessage.js";
|
|
332
332
|
export * from "./internchatmessagecontent.js";
|
|
333
333
|
export * from "./internchatprompttokensdetails.js";
|
|
334
|
+
export * from "./internchatsteeredresponse.js";
|
|
334
335
|
export * from "./internchatstreamerror.js";
|
|
335
336
|
export * from "./internchatstreamingresponse.js";
|
|
336
337
|
export * from "./internchatsystemmessage.js";
|
|
@@ -686,4 +687,5 @@ export * from "./workspace.js";
|
|
|
686
687
|
export * from "./workspacebudget.js";
|
|
687
688
|
export * from "./workspacebudgetinterval.js";
|
|
688
689
|
export * from "./workspacemember.js";
|
|
690
|
+
export * from "./xsearchoptions.js";
|
|
689
691
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/models/index.js
CHANGED
|
@@ -335,6 +335,7 @@ export * from "./internchaterrormetadata.js";
|
|
|
335
335
|
export * from "./internchatmessage.js";
|
|
336
336
|
export * from "./internchatmessagecontent.js";
|
|
337
337
|
export * from "./internchatprompttokensdetails.js";
|
|
338
|
+
export * from "./internchatsteeredresponse.js";
|
|
338
339
|
export * from "./internchatstreamerror.js";
|
|
339
340
|
export * from "./internchatstreamingresponse.js";
|
|
340
341
|
export * from "./internchatsystemmessage.js";
|
|
@@ -690,4 +691,5 @@ export * from "./workspace.js";
|
|
|
690
691
|
export * from "./workspacebudget.js";
|
|
691
692
|
export * from "./workspacebudgetinterval.js";
|
|
692
693
|
export * from "./workspacemember.js";
|
|
694
|
+
export * from "./xsearchoptions.js";
|
|
693
695
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* The message was handed to the turn already running on this session.
|
|
7
|
+
*/
|
|
8
|
+
export declare const InternChatSteeredResponseStatus: {
|
|
9
|
+
readonly Steered: "steered";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The message was handed to the turn already running on this session.
|
|
13
|
+
*/
|
|
14
|
+
export type InternChatSteeredResponseStatus = ClosedEnum<typeof InternChatSteeredResponseStatus>;
|
|
15
|
+
/**
|
|
16
|
+
* The message was delivered into the turn already running on the same session. Its effect is streamed on that turn, not here.
|
|
17
|
+
*/
|
|
18
|
+
export type InternChatSteeredResponse = {
|
|
19
|
+
/**
|
|
20
|
+
* The session of the running turn the message was delivered to.
|
|
21
|
+
*/
|
|
22
|
+
sessionId: string;
|
|
23
|
+
/**
|
|
24
|
+
* The message was handed to the turn already running on this session.
|
|
25
|
+
*/
|
|
26
|
+
status: InternChatSteeredResponseStatus;
|
|
27
|
+
};
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare const InternChatSteeredResponseStatus$inboundSchema: z.ZodEnum<typeof InternChatSteeredResponseStatus>;
|
|
30
|
+
/** @internal */
|
|
31
|
+
export declare const InternChatSteeredResponse$inboundSchema: z.ZodType<InternChatSteeredResponse, unknown>;
|
|
32
|
+
export declare function internChatSteeredResponseFromJSON(jsonString: string): SafeParseResult<InternChatSteeredResponse, SDKValidationError>;
|
|
33
|
+
//# sourceMappingURL=internchatsteeredresponse.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 81a2168a45b8
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
/**
|
|
9
|
+
* The message was handed to the turn already running on this session.
|
|
10
|
+
*/
|
|
11
|
+
export const InternChatSteeredResponseStatus = {
|
|
12
|
+
Steered: "steered",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const InternChatSteeredResponseStatus$inboundSchema = z.enum(InternChatSteeredResponseStatus);
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const InternChatSteeredResponse$inboundSchema = z.object({
|
|
18
|
+
session_id: z.string(),
|
|
19
|
+
status: InternChatSteeredResponseStatus$inboundSchema,
|
|
20
|
+
}).transform((v) => {
|
|
21
|
+
return remap$(v, {
|
|
22
|
+
"session_id": "sessionId",
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
export function internChatSteeredResponseFromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => InternChatSteeredResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatSteeredResponse' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=internchatsteeredresponse.js.map
|
|
@@ -7,6 +7,7 @@ import { WebSearchDomainFilter, WebSearchDomainFilter$Outbound } from "./websear
|
|
|
7
7
|
import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
8
8
|
import { WebSearchMode } from "./websearchmode.js";
|
|
9
9
|
import { WebSearchUserLocation, WebSearchUserLocation$Outbound } from "./websearchuserlocation.js";
|
|
10
|
+
import { XSearchOptions, XSearchOptions$Outbound } from "./xsearchoptions.js";
|
|
10
11
|
export declare const LegacyWebSearchServerToolType: {
|
|
11
12
|
readonly WebSearch: "web_search";
|
|
12
13
|
};
|
|
@@ -41,6 +42,10 @@ export type LegacyWebSearchServerTool = {
|
|
|
41
42
|
* User location information for web search
|
|
42
43
|
*/
|
|
43
44
|
userLocation?: WebSearchUserLocation | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
47
|
+
*/
|
|
48
|
+
xSearch?: XSearchOptions | undefined;
|
|
44
49
|
};
|
|
45
50
|
/** @internal */
|
|
46
51
|
export declare const LegacyWebSearchServerToolType$inboundSchema: z.ZodEnum<typeof LegacyWebSearchServerToolType>;
|
|
@@ -58,6 +63,7 @@ export type LegacyWebSearchServerTool$Outbound = {
|
|
|
58
63
|
search_context_size?: string | undefined;
|
|
59
64
|
type: string;
|
|
60
65
|
user_location?: WebSearchUserLocation$Outbound | null | undefined;
|
|
66
|
+
x_search?: XSearchOptions$Outbound | undefined;
|
|
61
67
|
};
|
|
62
68
|
/** @internal */
|
|
63
69
|
export declare const LegacyWebSearchServerTool$outboundSchema: z.ZodType<LegacyWebSearchServerTool$Outbound, LegacyWebSearchServerTool>;
|
|
@@ -10,6 +10,7 @@ import { WebSearchDomainFilter$inboundSchema, WebSearchDomainFilter$outboundSche
|
|
|
10
10
|
import { WebSearchEngineEnum$inboundSchema, WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
|
|
11
11
|
import { WebSearchMode$inboundSchema, WebSearchMode$outboundSchema, } from "./websearchmode.js";
|
|
12
12
|
import { WebSearchUserLocation$inboundSchema, WebSearchUserLocation$outboundSchema, } from "./websearchuserlocation.js";
|
|
13
|
+
import { XSearchOptions$inboundSchema, XSearchOptions$outboundSchema, } from "./xsearchoptions.js";
|
|
13
14
|
export const LegacyWebSearchServerToolType = {
|
|
14
15
|
WebSearch: "web_search",
|
|
15
16
|
};
|
|
@@ -27,12 +28,14 @@ export const LegacyWebSearchServerTool$inboundSchema = z.object({
|
|
|
27
28
|
search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
|
|
28
29
|
type: LegacyWebSearchServerToolType$inboundSchema,
|
|
29
30
|
user_location: z.nullable(WebSearchUserLocation$inboundSchema).optional(),
|
|
31
|
+
x_search: XSearchOptions$inboundSchema.optional(),
|
|
30
32
|
}).transform((v) => {
|
|
31
33
|
return remap$(v, {
|
|
32
34
|
"max_results": "maxResults",
|
|
33
35
|
"max_uses": "maxUses",
|
|
34
36
|
"search_context_size": "searchContextSize",
|
|
35
37
|
"user_location": "userLocation",
|
|
38
|
+
"x_search": "xSearch",
|
|
36
39
|
});
|
|
37
40
|
});
|
|
38
41
|
/** @internal */
|
|
@@ -45,12 +48,14 @@ export const LegacyWebSearchServerTool$outboundSchema = z.object({
|
|
|
45
48
|
searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
|
|
46
49
|
type: LegacyWebSearchServerToolType$outboundSchema,
|
|
47
50
|
userLocation: z.nullable(WebSearchUserLocation$outboundSchema).optional(),
|
|
51
|
+
xSearch: XSearchOptions$outboundSchema.optional(),
|
|
48
52
|
}).transform((v) => {
|
|
49
53
|
return remap$(v, {
|
|
50
54
|
maxResults: "max_results",
|
|
51
55
|
maxUses: "max_uses",
|
|
52
56
|
searchContextSize: "search_context_size",
|
|
53
57
|
userLocation: "user_location",
|
|
58
|
+
xSearch: "x_search",
|
|
54
59
|
});
|
|
55
60
|
});
|
|
56
61
|
export function legacyWebSearchServerToolToJSON(legacyWebSearchServerTool) {
|
|
@@ -50,11 +50,12 @@ export type CreateInternChatCompletionRequest = {
|
|
|
50
50
|
internId: string;
|
|
51
51
|
internChatCompletionRequest: models.InternChatCompletionRequest;
|
|
52
52
|
};
|
|
53
|
+
export type CreateInternChatCompletionResponseResult = models.InternChatSteeredResponse | EventStream<models.InternChatCompletionChunk>;
|
|
53
54
|
export type CreateInternChatCompletionResponse = {
|
|
54
55
|
headers: {
|
|
55
56
|
[k: string]: Array<string>;
|
|
56
57
|
};
|
|
57
|
-
result: EventStream<models.InternChatCompletionChunk>;
|
|
58
|
+
result: models.InternChatSteeredResponse | EventStream<models.InternChatCompletionChunk>;
|
|
58
59
|
};
|
|
59
60
|
/** @internal */
|
|
60
61
|
export type CreateInternChatCompletionRequest$Outbound = {
|
|
@@ -68,6 +69,9 @@ export type CreateInternChatCompletionRequest$Outbound = {
|
|
|
68
69
|
export declare const CreateInternChatCompletionRequest$outboundSchema: z.ZodType<CreateInternChatCompletionRequest$Outbound, CreateInternChatCompletionRequest>;
|
|
69
70
|
export declare function createInternChatCompletionRequestToJSON(createInternChatCompletionRequest: CreateInternChatCompletionRequest): string;
|
|
70
71
|
/** @internal */
|
|
72
|
+
export declare const CreateInternChatCompletionResponseResult$inboundSchema: z.ZodType<CreateInternChatCompletionResponseResult, unknown>;
|
|
73
|
+
export declare function createInternChatCompletionResponseResultFromJSON(jsonString: string): SafeParseResult<CreateInternChatCompletionResponseResult, SDKValidationError>;
|
|
74
|
+
/** @internal */
|
|
71
75
|
export declare const CreateInternChatCompletionResponse$inboundSchema: z.ZodType<CreateInternChatCompletionResponse, unknown>;
|
|
72
76
|
export declare function createInternChatCompletionResponseFromJSON(jsonString: string): SafeParseResult<CreateInternChatCompletionResponse, SDKValidationError>;
|
|
73
77
|
//# sourceMappingURL=createinternchatcompletion.d.ts.map
|
|
@@ -24,9 +24,9 @@ export function createInternChatCompletionRequestToJSON(createInternChatCompleti
|
|
|
24
24
|
return JSON.stringify(CreateInternChatCompletionRequest$outboundSchema.parse(createInternChatCompletionRequest));
|
|
25
25
|
}
|
|
26
26
|
/** @internal */
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export const CreateInternChatCompletionResponseResult$inboundSchema = z.union([
|
|
28
|
+
models.InternChatSteeredResponse$inboundSchema,
|
|
29
|
+
z.custom(x => x instanceof ReadableStream)
|
|
30
30
|
.transform(stream => {
|
|
31
31
|
return new EventStream(stream, rawEvent => {
|
|
32
32
|
if (rawEvent.data === "[DONE]")
|
|
@@ -37,6 +37,28 @@ export const CreateInternChatCompletionResponse$inboundSchema = z.object({
|
|
|
37
37
|
};
|
|
38
38
|
});
|
|
39
39
|
}),
|
|
40
|
+
]);
|
|
41
|
+
export function createInternChatCompletionResponseResultFromJSON(jsonString) {
|
|
42
|
+
return safeParse(jsonString, (x) => CreateInternChatCompletionResponseResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateInternChatCompletionResponseResult' from JSON`);
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const CreateInternChatCompletionResponse$inboundSchema = z.object({
|
|
46
|
+
Headers: z.record(z.string(), z.array(z.string())).default({}),
|
|
47
|
+
Result: z.union([
|
|
48
|
+
models.InternChatSteeredResponse$inboundSchema,
|
|
49
|
+
z.custom(x => x instanceof ReadableStream)
|
|
50
|
+
.transform(stream => {
|
|
51
|
+
return new EventStream(stream, rawEvent => {
|
|
52
|
+
if (rawEvent.data === "[DONE]") {
|
|
53
|
+
return { done: true, value: undefined };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
done: false,
|
|
57
|
+
value: models.InternChatStreamingResponse$inboundSchema.parse(rawEvent)?.data,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
}),
|
|
61
|
+
]),
|
|
40
62
|
}).transform((v) => {
|
|
41
63
|
return remap$(v, {
|
|
42
64
|
"Headers": "headers",
|
|
@@ -7,6 +7,7 @@ import { SearchContextSizeEnum } from "./searchcontextsizeenum.js";
|
|
|
7
7
|
import { WebSearchDomainFilter, WebSearchDomainFilter$Outbound } from "./websearchdomainfilter.js";
|
|
8
8
|
import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
9
9
|
import { WebSearchMode } from "./websearchmode.js";
|
|
10
|
+
import { XSearchOptions, XSearchOptions$Outbound } from "./xsearchoptions.js";
|
|
10
11
|
export declare const Preview20250311WebSearchServerToolType: {
|
|
11
12
|
readonly WebSearchPreview20250311: "web_search_preview_2025_03_11";
|
|
12
13
|
};
|
|
@@ -38,6 +39,10 @@ export type Preview20250311WebSearchServerTool = {
|
|
|
38
39
|
searchContextSize?: SearchContextSizeEnum | undefined;
|
|
39
40
|
type: Preview20250311WebSearchServerToolType;
|
|
40
41
|
userLocation?: PreviewWebSearchUserLocation | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
44
|
+
*/
|
|
45
|
+
xSearch?: XSearchOptions | undefined;
|
|
41
46
|
};
|
|
42
47
|
/** @internal */
|
|
43
48
|
export declare const Preview20250311WebSearchServerToolType$inboundSchema: z.ZodEnum<typeof Preview20250311WebSearchServerToolType>;
|
|
@@ -55,6 +60,7 @@ export type Preview20250311WebSearchServerTool$Outbound = {
|
|
|
55
60
|
search_context_size?: string | undefined;
|
|
56
61
|
type: string;
|
|
57
62
|
user_location?: PreviewWebSearchUserLocation$Outbound | null | undefined;
|
|
63
|
+
x_search?: XSearchOptions$Outbound | undefined;
|
|
58
64
|
};
|
|
59
65
|
/** @internal */
|
|
60
66
|
export declare const Preview20250311WebSearchServerTool$outboundSchema: z.ZodType<Preview20250311WebSearchServerTool$Outbound, Preview20250311WebSearchServerTool>;
|
|
@@ -10,6 +10,7 @@ import { SearchContextSizeEnum$inboundSchema, SearchContextSizeEnum$outboundSche
|
|
|
10
10
|
import { WebSearchDomainFilter$inboundSchema, WebSearchDomainFilter$outboundSchema, } from "./websearchdomainfilter.js";
|
|
11
11
|
import { WebSearchEngineEnum$inboundSchema, WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
|
|
12
12
|
import { WebSearchMode$inboundSchema, WebSearchMode$outboundSchema, } from "./websearchmode.js";
|
|
13
|
+
import { XSearchOptions$inboundSchema, XSearchOptions$outboundSchema, } from "./xsearchoptions.js";
|
|
13
14
|
export const Preview20250311WebSearchServerToolType = {
|
|
14
15
|
WebSearchPreview20250311: "web_search_preview_2025_03_11",
|
|
15
16
|
};
|
|
@@ -28,12 +29,14 @@ export const Preview20250311WebSearchServerTool$inboundSchema = z.object({
|
|
|
28
29
|
type: Preview20250311WebSearchServerToolType$inboundSchema,
|
|
29
30
|
user_location: z.nullable(PreviewWebSearchUserLocation$inboundSchema)
|
|
30
31
|
.optional(),
|
|
32
|
+
x_search: XSearchOptions$inboundSchema.optional(),
|
|
31
33
|
}).transform((v) => {
|
|
32
34
|
return remap$(v, {
|
|
33
35
|
"max_results": "maxResults",
|
|
34
36
|
"max_uses": "maxUses",
|
|
35
37
|
"search_context_size": "searchContextSize",
|
|
36
38
|
"user_location": "userLocation",
|
|
39
|
+
"x_search": "xSearch",
|
|
37
40
|
});
|
|
38
41
|
});
|
|
39
42
|
/** @internal */
|
|
@@ -47,12 +50,14 @@ export const Preview20250311WebSearchServerTool$outboundSchema = z.object({
|
|
|
47
50
|
type: Preview20250311WebSearchServerToolType$outboundSchema,
|
|
48
51
|
userLocation: z.nullable(PreviewWebSearchUserLocation$outboundSchema)
|
|
49
52
|
.optional(),
|
|
53
|
+
xSearch: XSearchOptions$outboundSchema.optional(),
|
|
50
54
|
}).transform((v) => {
|
|
51
55
|
return remap$(v, {
|
|
52
56
|
maxResults: "max_results",
|
|
53
57
|
maxUses: "max_uses",
|
|
54
58
|
searchContextSize: "search_context_size",
|
|
55
59
|
userLocation: "user_location",
|
|
60
|
+
xSearch: "x_search",
|
|
56
61
|
});
|
|
57
62
|
});
|
|
58
63
|
export function preview20250311WebSearchServerToolToJSON(preview20250311WebSearchServerTool) {
|
|
@@ -7,6 +7,7 @@ import { SearchContextSizeEnum } from "./searchcontextsizeenum.js";
|
|
|
7
7
|
import { WebSearchDomainFilter, WebSearchDomainFilter$Outbound } from "./websearchdomainfilter.js";
|
|
8
8
|
import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
9
9
|
import { WebSearchMode } from "./websearchmode.js";
|
|
10
|
+
import { XSearchOptions, XSearchOptions$Outbound } from "./xsearchoptions.js";
|
|
10
11
|
export declare const PreviewWebSearchServerToolType: {
|
|
11
12
|
readonly WebSearchPreview: "web_search_preview";
|
|
12
13
|
};
|
|
@@ -38,6 +39,10 @@ export type PreviewWebSearchServerTool = {
|
|
|
38
39
|
searchContextSize?: SearchContextSizeEnum | undefined;
|
|
39
40
|
type: PreviewWebSearchServerToolType;
|
|
40
41
|
userLocation?: PreviewWebSearchUserLocation | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
44
|
+
*/
|
|
45
|
+
xSearch?: XSearchOptions | undefined;
|
|
41
46
|
};
|
|
42
47
|
/** @internal */
|
|
43
48
|
export declare const PreviewWebSearchServerToolType$inboundSchema: z.ZodEnum<typeof PreviewWebSearchServerToolType>;
|
|
@@ -55,6 +60,7 @@ export type PreviewWebSearchServerTool$Outbound = {
|
|
|
55
60
|
search_context_size?: string | undefined;
|
|
56
61
|
type: string;
|
|
57
62
|
user_location?: PreviewWebSearchUserLocation$Outbound | null | undefined;
|
|
63
|
+
x_search?: XSearchOptions$Outbound | undefined;
|
|
58
64
|
};
|
|
59
65
|
/** @internal */
|
|
60
66
|
export declare const PreviewWebSearchServerTool$outboundSchema: z.ZodType<PreviewWebSearchServerTool$Outbound, PreviewWebSearchServerTool>;
|
|
@@ -10,6 +10,7 @@ import { SearchContextSizeEnum$inboundSchema, SearchContextSizeEnum$outboundSche
|
|
|
10
10
|
import { WebSearchDomainFilter$inboundSchema, WebSearchDomainFilter$outboundSchema, } from "./websearchdomainfilter.js";
|
|
11
11
|
import { WebSearchEngineEnum$inboundSchema, WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
|
|
12
12
|
import { WebSearchMode$inboundSchema, WebSearchMode$outboundSchema, } from "./websearchmode.js";
|
|
13
|
+
import { XSearchOptions$inboundSchema, XSearchOptions$outboundSchema, } from "./xsearchoptions.js";
|
|
13
14
|
export const PreviewWebSearchServerToolType = {
|
|
14
15
|
WebSearchPreview: "web_search_preview",
|
|
15
16
|
};
|
|
@@ -28,12 +29,14 @@ export const PreviewWebSearchServerTool$inboundSchema = z.object({
|
|
|
28
29
|
type: PreviewWebSearchServerToolType$inboundSchema,
|
|
29
30
|
user_location: z.nullable(PreviewWebSearchUserLocation$inboundSchema)
|
|
30
31
|
.optional(),
|
|
32
|
+
x_search: XSearchOptions$inboundSchema.optional(),
|
|
31
33
|
}).transform((v) => {
|
|
32
34
|
return remap$(v, {
|
|
33
35
|
"max_results": "maxResults",
|
|
34
36
|
"max_uses": "maxUses",
|
|
35
37
|
"search_context_size": "searchContextSize",
|
|
36
38
|
"user_location": "userLocation",
|
|
39
|
+
"x_search": "xSearch",
|
|
37
40
|
});
|
|
38
41
|
});
|
|
39
42
|
/** @internal */
|
|
@@ -47,12 +50,14 @@ export const PreviewWebSearchServerTool$outboundSchema = z.object({
|
|
|
47
50
|
type: PreviewWebSearchServerToolType$outboundSchema,
|
|
48
51
|
userLocation: z.nullable(PreviewWebSearchUserLocation$outboundSchema)
|
|
49
52
|
.optional(),
|
|
53
|
+
xSearch: XSearchOptions$outboundSchema.optional(),
|
|
50
54
|
}).transform((v) => {
|
|
51
55
|
return remap$(v, {
|
|
52
56
|
maxResults: "max_results",
|
|
53
57
|
maxUses: "max_uses",
|
|
54
58
|
searchContextSize: "search_context_size",
|
|
55
59
|
userLocation: "user_location",
|
|
60
|
+
xSearch: "x_search",
|
|
56
61
|
});
|
|
57
62
|
});
|
|
58
63
|
export function previewWebSearchServerToolToJSON(previewWebSearchServerTool) {
|
|
@@ -12,6 +12,10 @@ export type UpdateBYOKKeyRequest = {
|
|
|
12
12
|
* Optional allowlist of user IDs that may use this credential. `null` means no restriction.
|
|
13
13
|
*/
|
|
14
14
|
allowedUserIds?: Array<string> | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration.
|
|
17
|
+
*/
|
|
18
|
+
declaredZdr?: boolean | null | undefined;
|
|
15
19
|
/**
|
|
16
20
|
* Whether this credential is disabled.
|
|
17
21
|
*/
|
|
@@ -42,6 +46,7 @@ export type UpdateBYOKKeyRequest$Outbound = {
|
|
|
42
46
|
allowed_api_key_hashes?: Array<string> | null | undefined;
|
|
43
47
|
allowed_models?: Array<string> | null | undefined;
|
|
44
48
|
allowed_user_ids?: Array<string> | null | undefined;
|
|
49
|
+
declared_zdr?: boolean | null | undefined;
|
|
45
50
|
disabled?: boolean | undefined;
|
|
46
51
|
is_byok_only?: boolean | undefined;
|
|
47
52
|
is_fallback?: boolean | undefined;
|
|
@@ -9,6 +9,7 @@ export const UpdateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
9
9
|
allowedApiKeyHashes: z.nullable(z.array(z.string())).optional(),
|
|
10
10
|
allowedModels: z.nullable(z.array(z.string())).optional(),
|
|
11
11
|
allowedUserIds: z.nullable(z.array(z.string())).optional(),
|
|
12
|
+
declaredZdr: z.nullable(z.boolean()).optional(),
|
|
12
13
|
disabled: z.boolean().optional(),
|
|
13
14
|
isByokOnly: z.boolean().optional(),
|
|
14
15
|
isFallback: z.boolean().optional(),
|
|
@@ -20,6 +21,7 @@ export const UpdateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
20
21
|
allowedApiKeyHashes: "allowed_api_key_hashes",
|
|
21
22
|
allowedModels: "allowed_models",
|
|
22
23
|
allowedUserIds: "allowed_user_ids",
|
|
24
|
+
declaredZdr: "declared_zdr",
|
|
23
25
|
isByokOnly: "is_byok_only",
|
|
24
26
|
isFallback: "is_fallback",
|
|
25
27
|
isRequired: "is_required",
|
|
@@ -3,9 +3,10 @@ import { SearchQualityLevel } from "./searchqualitylevel.js";
|
|
|
3
3
|
import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
4
4
|
import { WebSearchMode } from "./websearchmode.js";
|
|
5
5
|
import { WebSearchUserLocationServerTool, WebSearchUserLocationServerTool$Outbound } from "./websearchuserlocationservertool.js";
|
|
6
|
+
import { XSearchOptions, XSearchOptions$Outbound } from "./xsearchoptions.js";
|
|
6
7
|
export type WebSearchConfig = {
|
|
7
8
|
/**
|
|
8
|
-
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI,
|
|
9
|
+
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, SpaceXAI). Cannot be used with excluded_domains.
|
|
9
10
|
*/
|
|
10
11
|
allowedDomains?: Array<string> | undefined;
|
|
11
12
|
/**
|
|
@@ -13,7 +14,7 @@ export type WebSearchConfig = {
|
|
|
13
14
|
*/
|
|
14
15
|
engine?: WebSearchEngineEnum | undefined;
|
|
15
16
|
/**
|
|
16
|
-
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, OpenAI, and
|
|
17
|
+
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, OpenAI, and SpaceXAI. Cannot be used with allowed_domains.
|
|
17
18
|
*/
|
|
18
19
|
excludedDomains?: Array<string> | undefined;
|
|
19
20
|
/**
|
|
@@ -44,6 +45,10 @@ export type WebSearchConfig = {
|
|
|
44
45
|
* Approximate user location for location-biased results.
|
|
45
46
|
*/
|
|
46
47
|
userLocation?: WebSearchUserLocationServerTool | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
50
|
+
*/
|
|
51
|
+
xSearch?: XSearchOptions | undefined;
|
|
47
52
|
};
|
|
48
53
|
/** @internal */
|
|
49
54
|
export type WebSearchConfig$Outbound = {
|
|
@@ -57,6 +62,7 @@ export type WebSearchConfig$Outbound = {
|
|
|
57
62
|
mode?: string | undefined;
|
|
58
63
|
search_context_size?: string | undefined;
|
|
59
64
|
user_location?: WebSearchUserLocationServerTool$Outbound | undefined;
|
|
65
|
+
x_search?: XSearchOptions$Outbound | undefined;
|
|
60
66
|
};
|
|
61
67
|
/** @internal */
|
|
62
68
|
export declare const WebSearchConfig$outboundSchema: z.ZodType<WebSearchConfig$Outbound, WebSearchConfig>;
|
|
@@ -8,6 +8,7 @@ import { SearchQualityLevel$outboundSchema, } from "./searchqualitylevel.js";
|
|
|
8
8
|
import { WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
|
|
9
9
|
import { WebSearchMode$outboundSchema, } from "./websearchmode.js";
|
|
10
10
|
import { WebSearchUserLocationServerTool$outboundSchema, } from "./websearchuserlocationservertool.js";
|
|
11
|
+
import { XSearchOptions$outboundSchema, } from "./xsearchoptions.js";
|
|
11
12
|
/** @internal */
|
|
12
13
|
export const WebSearchConfig$outboundSchema = z.object({
|
|
13
14
|
allowedDomains: z.array(z.string()).optional(),
|
|
@@ -20,6 +21,7 @@ export const WebSearchConfig$outboundSchema = z.object({
|
|
|
20
21
|
mode: WebSearchMode$outboundSchema.optional(),
|
|
21
22
|
searchContextSize: SearchQualityLevel$outboundSchema.optional(),
|
|
22
23
|
userLocation: WebSearchUserLocationServerTool$outboundSchema.optional(),
|
|
24
|
+
xSearch: XSearchOptions$outboundSchema.optional(),
|
|
23
25
|
}).transform((v) => {
|
|
24
26
|
return remap$(v, {
|
|
25
27
|
allowedDomains: "allowed_domains",
|
|
@@ -30,6 +32,7 @@ export const WebSearchConfig$outboundSchema = z.object({
|
|
|
30
32
|
maxUses: "max_uses",
|
|
31
33
|
searchContextSize: "search_context_size",
|
|
32
34
|
userLocation: "user_location",
|
|
35
|
+
xSearch: "x_search",
|
|
33
36
|
});
|
|
34
37
|
});
|
|
35
38
|
export function webSearchConfigToJSON(webSearchConfig) {
|
|
@@ -2,6 +2,7 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { ClosedEnum } from "../types/enums.js";
|
|
3
3
|
import { WebSearchEngine } from "./websearchengine.js";
|
|
4
4
|
import { WebSearchMode } from "./websearchmode.js";
|
|
5
|
+
import { XSearchOptions, XSearchOptions$Outbound } from "./xsearchoptions.js";
|
|
5
6
|
export declare const WebSearchPluginType: {
|
|
6
7
|
readonly Approximate: "approximate";
|
|
7
8
|
};
|
|
@@ -45,6 +46,10 @@ export type WebSearchPlugin = {
|
|
|
45
46
|
mode?: WebSearchMode | undefined;
|
|
46
47
|
searchPrompt?: string | undefined;
|
|
47
48
|
userLocation?: UserLocation | null | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
51
|
+
*/
|
|
52
|
+
xSearch?: XSearchOptions | undefined;
|
|
48
53
|
};
|
|
49
54
|
/** @internal */
|
|
50
55
|
export declare const WebSearchPluginType$outboundSchema: z.ZodEnum<typeof WebSearchPluginType>;
|
|
@@ -71,6 +76,7 @@ export type WebSearchPlugin$Outbound = {
|
|
|
71
76
|
mode?: string | undefined;
|
|
72
77
|
search_prompt?: string | undefined;
|
|
73
78
|
user_location?: UserLocation$Outbound | null | undefined;
|
|
79
|
+
x_search?: XSearchOptions$Outbound | undefined;
|
|
74
80
|
};
|
|
75
81
|
/** @internal */
|
|
76
82
|
export declare const WebSearchPlugin$outboundSchema: z.ZodType<WebSearchPlugin$Outbound, WebSearchPlugin>;
|
|
@@ -6,6 +6,7 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { WebSearchEngine$outboundSchema, } from "./websearchengine.js";
|
|
8
8
|
import { WebSearchMode$outboundSchema, } from "./websearchmode.js";
|
|
9
|
+
import { XSearchOptions$outboundSchema, } from "./xsearchoptions.js";
|
|
9
10
|
export const WebSearchPluginType = {
|
|
10
11
|
Approximate: "approximate",
|
|
11
12
|
};
|
|
@@ -35,6 +36,7 @@ export const WebSearchPlugin$outboundSchema = z.object({
|
|
|
35
36
|
searchPrompt: z.string().optional(),
|
|
36
37
|
userLocation: z.nullable(z.lazy(() => UserLocation$outboundSchema))
|
|
37
38
|
.optional(),
|
|
39
|
+
xSearch: XSearchOptions$outboundSchema.optional(),
|
|
38
40
|
}).transform((v) => {
|
|
39
41
|
return remap$(v, {
|
|
40
42
|
excludeDomains: "exclude_domains",
|
|
@@ -43,6 +45,7 @@ export const WebSearchPlugin$outboundSchema = z.object({
|
|
|
43
45
|
maxUses: "max_uses",
|
|
44
46
|
searchPrompt: "search_prompt",
|
|
45
47
|
userLocation: "user_location",
|
|
48
|
+
xSearch: "x_search",
|
|
46
49
|
});
|
|
47
50
|
});
|
|
48
51
|
export function webSearchPluginToJSON(webSearchPlugin) {
|
|
@@ -7,6 +7,7 @@ import { WebSearchDomainFilter, WebSearchDomainFilter$Outbound } from "./websear
|
|
|
7
7
|
import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
8
8
|
import { WebSearchMode } from "./websearchmode.js";
|
|
9
9
|
import { WebSearchUserLocation, WebSearchUserLocation$Outbound } from "./websearchuserlocation.js";
|
|
10
|
+
import { XSearchOptions, XSearchOptions$Outbound } from "./xsearchoptions.js";
|
|
10
11
|
export declare const WebSearchServerToolType: {
|
|
11
12
|
readonly WebSearch20250826: "web_search_2025_08_26";
|
|
12
13
|
};
|
|
@@ -41,6 +42,10 @@ export type WebSearchServerTool = {
|
|
|
41
42
|
* User location information for web search
|
|
42
43
|
*/
|
|
43
44
|
userLocation?: WebSearchUserLocation | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
47
|
+
*/
|
|
48
|
+
xSearch?: XSearchOptions | undefined;
|
|
44
49
|
};
|
|
45
50
|
/** @internal */
|
|
46
51
|
export declare const WebSearchServerToolType$inboundSchema: z.ZodEnum<typeof WebSearchServerToolType>;
|
|
@@ -58,6 +63,7 @@ export type WebSearchServerTool$Outbound = {
|
|
|
58
63
|
search_context_size?: string | undefined;
|
|
59
64
|
type: string;
|
|
60
65
|
user_location?: WebSearchUserLocation$Outbound | null | undefined;
|
|
66
|
+
x_search?: XSearchOptions$Outbound | undefined;
|
|
61
67
|
};
|
|
62
68
|
/** @internal */
|
|
63
69
|
export declare const WebSearchServerTool$outboundSchema: z.ZodType<WebSearchServerTool$Outbound, WebSearchServerTool>;
|
|
@@ -10,6 +10,7 @@ import { WebSearchDomainFilter$inboundSchema, WebSearchDomainFilter$outboundSche
|
|
|
10
10
|
import { WebSearchEngineEnum$inboundSchema, WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
|
|
11
11
|
import { WebSearchMode$inboundSchema, WebSearchMode$outboundSchema, } from "./websearchmode.js";
|
|
12
12
|
import { WebSearchUserLocation$inboundSchema, WebSearchUserLocation$outboundSchema, } from "./websearchuserlocation.js";
|
|
13
|
+
import { XSearchOptions$inboundSchema, XSearchOptions$outboundSchema, } from "./xsearchoptions.js";
|
|
13
14
|
export const WebSearchServerToolType = {
|
|
14
15
|
WebSearch20250826: "web_search_2025_08_26",
|
|
15
16
|
};
|
|
@@ -27,12 +28,14 @@ export const WebSearchServerTool$inboundSchema = z.object({
|
|
|
27
28
|
search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
|
|
28
29
|
type: WebSearchServerToolType$inboundSchema,
|
|
29
30
|
user_location: z.nullable(WebSearchUserLocation$inboundSchema).optional(),
|
|
31
|
+
x_search: XSearchOptions$inboundSchema.optional(),
|
|
30
32
|
}).transform((v) => {
|
|
31
33
|
return remap$(v, {
|
|
32
34
|
"max_results": "maxResults",
|
|
33
35
|
"max_uses": "maxUses",
|
|
34
36
|
"search_context_size": "searchContextSize",
|
|
35
37
|
"user_location": "userLocation",
|
|
38
|
+
"x_search": "xSearch",
|
|
36
39
|
});
|
|
37
40
|
});
|
|
38
41
|
/** @internal */
|
|
@@ -45,12 +48,14 @@ export const WebSearchServerTool$outboundSchema = z.object({
|
|
|
45
48
|
searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
|
|
46
49
|
type: WebSearchServerToolType$outboundSchema,
|
|
47
50
|
userLocation: z.nullable(WebSearchUserLocation$outboundSchema).optional(),
|
|
51
|
+
xSearch: XSearchOptions$outboundSchema.optional(),
|
|
48
52
|
}).transform((v) => {
|
|
49
53
|
return remap$(v, {
|
|
50
54
|
maxResults: "max_results",
|
|
51
55
|
maxUses: "max_uses",
|
|
52
56
|
searchContextSize: "search_context_size",
|
|
53
57
|
userLocation: "user_location",
|
|
58
|
+
xSearch: "x_search",
|
|
54
59
|
});
|
|
55
60
|
});
|
|
56
61
|
export function webSearchServerToolToJSON(webSearchServerTool) {
|
|
@@ -3,12 +3,13 @@ import { SearchQualityLevel } from "./searchqualitylevel.js";
|
|
|
3
3
|
import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
4
4
|
import { WebSearchMode } from "./websearchmode.js";
|
|
5
5
|
import { WebSearchUserLocationServerTool, WebSearchUserLocationServerTool$Outbound } from "./websearchuserlocationservertool.js";
|
|
6
|
+
import { XSearchOptions, XSearchOptions$Outbound } from "./xsearchoptions.js";
|
|
6
7
|
/**
|
|
7
8
|
* Configuration for the openrouter:web_search server tool
|
|
8
9
|
*/
|
|
9
10
|
export type WebSearchServerToolConfig = {
|
|
10
11
|
/**
|
|
11
|
-
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI,
|
|
12
|
+
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, SpaceXAI). Cannot be used with excluded_domains.
|
|
12
13
|
*/
|
|
13
14
|
allowedDomains?: Array<string> | undefined;
|
|
14
15
|
/**
|
|
@@ -16,7 +17,7 @@ export type WebSearchServerToolConfig = {
|
|
|
16
17
|
*/
|
|
17
18
|
engine?: WebSearchEngineEnum | undefined;
|
|
18
19
|
/**
|
|
19
|
-
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, OpenAI, and
|
|
20
|
+
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, OpenAI, and SpaceXAI. Cannot be used with allowed_domains.
|
|
20
21
|
*/
|
|
21
22
|
excludedDomains?: Array<string> | undefined;
|
|
22
23
|
/**
|
|
@@ -47,6 +48,10 @@ export type WebSearchServerToolConfig = {
|
|
|
47
48
|
* Approximate user location for location-biased results.
|
|
48
49
|
*/
|
|
49
50
|
userLocation?: WebSearchUserLocationServerTool | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
53
|
+
*/
|
|
54
|
+
xSearch?: XSearchOptions | undefined;
|
|
50
55
|
};
|
|
51
56
|
/** @internal */
|
|
52
57
|
export type WebSearchServerToolConfig$Outbound = {
|
|
@@ -60,6 +65,7 @@ export type WebSearchServerToolConfig$Outbound = {
|
|
|
60
65
|
mode?: string | undefined;
|
|
61
66
|
search_context_size?: string | undefined;
|
|
62
67
|
user_location?: WebSearchUserLocationServerTool$Outbound | undefined;
|
|
68
|
+
x_search?: XSearchOptions$Outbound | undefined;
|
|
63
69
|
};
|
|
64
70
|
/** @internal */
|
|
65
71
|
export declare const WebSearchServerToolConfig$outboundSchema: z.ZodType<WebSearchServerToolConfig$Outbound, WebSearchServerToolConfig>;
|
|
@@ -8,6 +8,7 @@ import { SearchQualityLevel$outboundSchema, } from "./searchqualitylevel.js";
|
|
|
8
8
|
import { WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
|
|
9
9
|
import { WebSearchMode$outboundSchema, } from "./websearchmode.js";
|
|
10
10
|
import { WebSearchUserLocationServerTool$outboundSchema, } from "./websearchuserlocationservertool.js";
|
|
11
|
+
import { XSearchOptions$outboundSchema, } from "./xsearchoptions.js";
|
|
11
12
|
/** @internal */
|
|
12
13
|
export const WebSearchServerToolConfig$outboundSchema = z.object({
|
|
13
14
|
allowedDomains: z.array(z.string()).optional(),
|
|
@@ -20,6 +21,7 @@ export const WebSearchServerToolConfig$outboundSchema = z.object({
|
|
|
20
21
|
mode: WebSearchMode$outboundSchema.optional(),
|
|
21
22
|
searchContextSize: SearchQualityLevel$outboundSchema.optional(),
|
|
22
23
|
userLocation: WebSearchUserLocationServerTool$outboundSchema.optional(),
|
|
24
|
+
xSearch: XSearchOptions$outboundSchema.optional(),
|
|
23
25
|
}).transform((v) => {
|
|
24
26
|
return remap$(v, {
|
|
25
27
|
allowedDomains: "allowed_domains",
|
|
@@ -30,6 +32,7 @@ export const WebSearchServerToolConfig$outboundSchema = z.object({
|
|
|
30
32
|
maxUses: "max_uses",
|
|
31
33
|
searchContextSize: "search_context_size",
|
|
32
34
|
userLocation: "user_location",
|
|
35
|
+
xSearch: "x_search",
|
|
33
36
|
});
|
|
34
37
|
});
|
|
35
38
|
export function webSearchServerToolConfigToJSON(webSearchServerToolConfig) {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { RFCDate } from "../types/rfcdate.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* Enable SpaceXAI X (Twitter) search alongside native web search, with optional filters. Only applies to SpaceXAI endpoints with native search; omit to search the web only. X search is billed separately by SpaceXAI, per post and per user profile fetched.
|
|
7
|
+
*/
|
|
8
|
+
export type XSearchOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Only include posts from these X handles (max 20). Cannot be used with excluded_x_handles.
|
|
11
|
+
*/
|
|
12
|
+
allowedXHandles?: Array<string> | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Analyze images attached to matching posts.
|
|
15
|
+
*/
|
|
16
|
+
enableImageUnderstanding?: boolean | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Analyze videos attached to matching posts.
|
|
19
|
+
*/
|
|
20
|
+
enableVideoUnderstanding?: boolean | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Exclude posts from these X handles (max 20). Cannot be used with allowed_x_handles.
|
|
23
|
+
*/
|
|
24
|
+
excludedXHandles?: Array<string> | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Start of the post date range (ISO 8601 date, e.g. "2025-01-01").
|
|
27
|
+
*/
|
|
28
|
+
fromDate?: RFCDate | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* End of the post date range (ISO 8601 date, e.g. "2025-12-31").
|
|
31
|
+
*/
|
|
32
|
+
toDate?: RFCDate | undefined;
|
|
33
|
+
};
|
|
34
|
+
/** @internal */
|
|
35
|
+
export declare const XSearchOptions$inboundSchema: z.ZodType<XSearchOptions, unknown>;
|
|
36
|
+
/** @internal */
|
|
37
|
+
export type XSearchOptions$Outbound = {
|
|
38
|
+
allowed_x_handles?: Array<string> | undefined;
|
|
39
|
+
enable_image_understanding?: boolean | undefined;
|
|
40
|
+
enable_video_understanding?: boolean | undefined;
|
|
41
|
+
excluded_x_handles?: Array<string> | undefined;
|
|
42
|
+
from_date?: string | undefined;
|
|
43
|
+
to_date?: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
/** @internal */
|
|
46
|
+
export declare const XSearchOptions$outboundSchema: z.ZodType<XSearchOptions$Outbound, XSearchOptions>;
|
|
47
|
+
export declare function xSearchOptionsToJSON(xSearchOptions: XSearchOptions): string;
|
|
48
|
+
export declare function xSearchOptionsFromJSON(jsonString: string): SafeParseResult<XSearchOptions, SDKValidationError>;
|
|
49
|
+
//# sourceMappingURL=xsearchoptions.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: d7a145785d12
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { RFCDate } from "../types/rfcdate.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const XSearchOptions$inboundSchema = z.object({
|
|
11
|
+
allowed_x_handles: z.array(z.string()).optional(),
|
|
12
|
+
enable_image_understanding: z.boolean().optional(),
|
|
13
|
+
enable_video_understanding: z.boolean().optional(),
|
|
14
|
+
excluded_x_handles: z.array(z.string()).optional(),
|
|
15
|
+
from_date: z.string().transform(v => new RFCDate(v)).optional(),
|
|
16
|
+
to_date: z.string().transform(v => new RFCDate(v)).optional(),
|
|
17
|
+
}).transform((v) => {
|
|
18
|
+
return remap$(v, {
|
|
19
|
+
"allowed_x_handles": "allowedXHandles",
|
|
20
|
+
"enable_image_understanding": "enableImageUnderstanding",
|
|
21
|
+
"enable_video_understanding": "enableVideoUnderstanding",
|
|
22
|
+
"excluded_x_handles": "excludedXHandles",
|
|
23
|
+
"from_date": "fromDate",
|
|
24
|
+
"to_date": "toDate",
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const XSearchOptions$outboundSchema = z.object({
|
|
29
|
+
allowedXHandles: z.array(z.string()).optional(),
|
|
30
|
+
enableImageUnderstanding: z.boolean().optional(),
|
|
31
|
+
enableVideoUnderstanding: z.boolean().optional(),
|
|
32
|
+
excludedXHandles: z.array(z.string()).optional(),
|
|
33
|
+
fromDate: z.custom(x => x instanceof RFCDate).transform(v => v.toString()).optional(),
|
|
34
|
+
toDate: z.custom(x => x instanceof RFCDate).transform(v => v.toString()).optional(),
|
|
35
|
+
}).transform((v) => {
|
|
36
|
+
return remap$(v, {
|
|
37
|
+
allowedXHandles: "allowed_x_handles",
|
|
38
|
+
enableImageUnderstanding: "enable_image_understanding",
|
|
39
|
+
enableVideoUnderstanding: "enable_video_understanding",
|
|
40
|
+
excludedXHandles: "excluded_x_handles",
|
|
41
|
+
fromDate: "from_date",
|
|
42
|
+
toDate: "to_date",
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
export function xSearchOptionsToJSON(xSearchOptions) {
|
|
46
|
+
return JSON.stringify(XSearchOptions$outboundSchema.parse(xSearchOptions));
|
|
47
|
+
}
|
|
48
|
+
export function xSearchOptionsFromJSON(jsonString) {
|
|
49
|
+
return safeParse(jsonString, (x) => XSearchOptions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'XSearchOptions' from JSON`);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=xsearchoptions.js.map
|
package/esm/sdk/interns.d.ts
CHANGED
|
@@ -69,6 +69,16 @@ export declare class Interns extends ClientSDK {
|
|
|
69
69
|
*
|
|
70
70
|
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
71
71
|
*/
|
|
72
|
+
chat(request: operations.CreateInternChatCompletionRequest & {
|
|
73
|
+
internChatCompletionRequest: {
|
|
74
|
+
stream?: false | undefined;
|
|
75
|
+
};
|
|
76
|
+
}, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
77
|
+
chat(request: operations.CreateInternChatCompletionRequest & {
|
|
78
|
+
internChatCompletionRequest: {
|
|
79
|
+
stream: true;
|
|
80
|
+
};
|
|
81
|
+
}, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
72
82
|
chat(request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
73
83
|
}
|
|
74
84
|
//# sourceMappingURL=interns.d.ts.map
|
package/esm/sdk/interns.js
CHANGED
|
@@ -76,24 +76,6 @@ export class Interns extends ClientSDK {
|
|
|
76
76
|
async suspendIntern(request, options) {
|
|
77
77
|
return unwrapAsync(internsSuspendIntern(this, request, options));
|
|
78
78
|
}
|
|
79
|
-
/**
|
|
80
|
-
* Stream a chat completion with an intern
|
|
81
|
-
*
|
|
82
|
-
* @remarks
|
|
83
|
-
* Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
|
|
84
|
-
*
|
|
85
|
-
* Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
|
|
86
|
-
*
|
|
87
|
-
* To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
|
|
88
|
-
*
|
|
89
|
-
* Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
|
|
90
|
-
*
|
|
91
|
-
* A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
|
|
92
|
-
*
|
|
93
|
-
* Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
|
|
94
|
-
*
|
|
95
|
-
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
96
|
-
*/
|
|
97
79
|
async chat(request, options) {
|
|
98
80
|
return unwrapAsync(internsChat(this, request, options));
|
|
99
81
|
}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.12",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
+
"typecheck": "tsc --noEmit",
|
|
76
77
|
"compile": "tsc",
|
|
77
78
|
"prepare": "npm run build",
|
|
78
|
-
"test": "
|
|
79
|
-
"test:e2e": "vitest --run --project e2e",
|
|
79
|
+
"test:transit": "exit 0",
|
|
80
80
|
"test:watch": "vitest --watch --project unit",
|
|
81
81
|
"typecheck:transit": "exit 0",
|
|
82
82
|
"postinstall": "node scripts/check-types.js || true",
|
|
83
|
-
"test
|
|
84
|
-
"
|
|
83
|
+
"test": "vitest --run --project unit",
|
|
84
|
+
"test:e2e": "vitest --run --project e2e"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|