@openrouter/sdk 1.2.136 → 1.2.138
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 +34 -0
- package/esm/funcs/internsChat.js +133 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/agentmessageitem.d.ts +3 -1
- package/esm/models/agentmessageitem.js +2 -0
- package/esm/models/customtoolcalloutputitem.d.ts +3 -1
- package/esm/models/customtoolcalloutputitem.js +2 -0
- package/esm/models/easyinputmessage.d.ts +3 -1
- package/esm/models/easyinputmessage.js +2 -0
- package/esm/models/errors/index.d.ts +1 -0
- package/esm/models/errors/index.js +1 -0
- package/esm/models/errors/internchaterrorresponse.d.ts +31 -0
- package/esm/models/errors/internchaterrorresponse.js +35 -0
- package/esm/models/functioncalloutputitem.d.ts +3 -1
- package/esm/models/functioncalloutputitem.js +2 -0
- package/esm/models/incompletedetails.d.ts +4 -4
- package/esm/models/incompletedetails.js +3 -4
- package/esm/models/index.d.ts +23 -0
- package/esm/models/index.js +23 -0
- package/esm/models/inputimage.d.ts +3 -1
- package/esm/models/inputimage.js +4 -0
- package/esm/models/inputmessageitem.d.ts +3 -1
- package/esm/models/inputmessageitem.js +2 -0
- package/esm/models/internapprovalmode.d.ts +16 -0
- package/esm/models/internapprovalmode.js +15 -0
- package/esm/models/internchatassistantmessage.d.ts +24 -0
- package/esm/models/internchatassistantmessage.js +22 -0
- package/esm/models/internchatchoice.d.ts +37 -0
- package/esm/models/internchatchoice.js +33 -0
- package/esm/models/internchatcompletionchunk.d.ts +48 -0
- package/esm/models/internchatcompletionchunk.js +34 -0
- package/esm/models/internchatcompletionrequest.d.ts +40 -0
- package/esm/models/internchatcompletionrequest.js +25 -0
- package/esm/models/internchatdelta.d.ts +24 -0
- package/esm/models/internchatdelta.js +28 -0
- package/esm/models/internchatdevelopermessage.d.ts +21 -0
- package/esm/models/internchatdevelopermessage.js +15 -0
- package/esm/models/internchatechoedtoolcall.d.ts +21 -0
- package/esm/models/internchatechoedtoolcall.js +15 -0
- package/esm/models/internchatechoedtoolcallfunction.d.ts +17 -0
- package/esm/models/internchatechoedtoolcallfunction.js +14 -0
- package/esm/models/internchaterror.d.ts +22 -0
- package/esm/models/internchaterror.js +17 -0
- package/esm/models/internchaterrormetadata.d.ts +44 -0
- package/esm/models/internchaterrormetadata.js +38 -0
- package/esm/models/internchatmessage.d.ts +16 -0
- package/esm/models/internchatmessage.js +22 -0
- package/esm/models/internchatmessagecontent.d.ts +12 -0
- package/esm/models/internchatmessagecontent.js +12 -0
- package/esm/models/internchatprompttokensdetails.d.ts +13 -0
- package/esm/models/internchatprompttokensdetails.js +19 -0
- package/esm/models/internchatstreamerror.d.ts +22 -0
- package/esm/models/internchatstreamerror.js +17 -0
- package/esm/models/internchatstreamingresponse.d.ts +17 -0
- package/esm/models/internchatstreamingresponse.js +29 -0
- package/esm/models/internchatsystemmessage.d.ts +21 -0
- package/esm/models/internchatsystemmessage.js +15 -0
- package/esm/models/internchattextpart.d.ts +24 -0
- package/esm/models/internchattextpart.js +19 -0
- package/esm/models/internchattoolcall.d.ts +30 -0
- package/esm/models/internchattoolcall.js +23 -0
- package/esm/models/internchattoolcallfunction.d.ts +24 -0
- package/esm/models/internchattoolcallfunction.js +20 -0
- package/esm/models/internchattoolmessage.d.ts +23 -0
- package/esm/models/internchattoolmessage.js +21 -0
- package/esm/models/internchatusage.d.ts +24 -0
- package/esm/models/internchatusage.js +27 -0
- package/esm/models/internchatusermessage.d.ts +21 -0
- package/esm/models/internchatusermessage.js +15 -0
- package/esm/models/operations/createinternchatcompletion.d.ts +61 -0
- package/esm/models/operations/createinternchatcompletion.js +24 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/sdk/interns.d.ts +20 -0
- package/esm/sdk/interns.js +22 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
3
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
5
|
+
import * as errors from "../models/errors/index.js";
|
|
6
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
7
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
8
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
9
|
+
import * as models from "../models/index.js";
|
|
10
|
+
import * as operations from "../models/operations/index.js";
|
|
11
|
+
import { APIPromise } from "../types/async.js";
|
|
12
|
+
import { Result } from "../types/fp.js";
|
|
13
|
+
/**
|
|
14
|
+
* Stream a chat completion with an intern
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* 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.
|
|
18
|
+
*
|
|
19
|
+
* 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.
|
|
20
|
+
*
|
|
21
|
+
* 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.
|
|
22
|
+
*
|
|
23
|
+
* 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 disconnect is noticed when the intern next writes to the stream, which during a silent tool run can take more than one 30 second heartbeat interval.
|
|
24
|
+
*
|
|
25
|
+
* 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.
|
|
26
|
+
*
|
|
27
|
+
* 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.
|
|
28
|
+
*
|
|
29
|
+
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
30
|
+
*
|
|
31
|
+
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
32
|
+
*/
|
|
33
|
+
export declare function internsChat(client: OpenRouterCore, request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): APIPromise<Result<EventStream<models.InternChatCompletionChunk>, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
34
|
+
//# sourceMappingURL=internsChat.d.ts.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 36149dc7ea8d
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import * as errors from "../models/errors/index.js";
|
|
15
|
+
import * as models from "../models/index.js";
|
|
16
|
+
import * as operations from "../models/operations/index.js";
|
|
17
|
+
import { APIPromise } from "../types/async.js";
|
|
18
|
+
/**
|
|
19
|
+
* Stream a chat completion with an intern
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* 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.
|
|
23
|
+
*
|
|
24
|
+
* 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.
|
|
25
|
+
*
|
|
26
|
+
* 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.
|
|
27
|
+
*
|
|
28
|
+
* 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 disconnect is noticed when the intern next writes to the stream, which during a silent tool run can take more than one 30 second heartbeat interval.
|
|
29
|
+
*
|
|
30
|
+
* 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.
|
|
31
|
+
*
|
|
32
|
+
* 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.
|
|
33
|
+
*
|
|
34
|
+
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
35
|
+
*
|
|
36
|
+
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
37
|
+
*/
|
|
38
|
+
export function internsChat(client, request, options) {
|
|
39
|
+
return new APIPromise($do(client, request, options));
|
|
40
|
+
}
|
|
41
|
+
async function $do(client, request, options) {
|
|
42
|
+
const parsed = safeParse(request, (value) => operations.CreateInternChatCompletionRequest$outboundSchema.parse(value), "Input validation failed");
|
|
43
|
+
if (!parsed.ok) {
|
|
44
|
+
return [parsed, { status: "invalid" }];
|
|
45
|
+
}
|
|
46
|
+
const payload = parsed.value;
|
|
47
|
+
const body = encodeJSON("body", payload.InternChatCompletionRequest, {
|
|
48
|
+
explode: true,
|
|
49
|
+
});
|
|
50
|
+
const pathParams = {
|
|
51
|
+
internId: encodeSimple("internId", payload.internId, {
|
|
52
|
+
explode: false,
|
|
53
|
+
charEncoding: "percent",
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
const path = pathToFunc("/interns/{internId}/chat/completions")(pathParams);
|
|
57
|
+
const headers = new Headers(compactMap({
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
Accept: "text/event-stream",
|
|
60
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
61
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
62
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
63
|
+
}));
|
|
64
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
65
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
66
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
67
|
+
const context = {
|
|
68
|
+
options: client._options,
|
|
69
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
70
|
+
operationID: "createInternChatCompletion",
|
|
71
|
+
oAuth2Scopes: null,
|
|
72
|
+
resolvedSecurity: requestSecurity,
|
|
73
|
+
securitySource: client._options.apiKey,
|
|
74
|
+
retryConfig: options?.retries
|
|
75
|
+
|| client._options.retryConfig
|
|
76
|
+
|| {
|
|
77
|
+
strategy: "backoff",
|
|
78
|
+
backoff: {
|
|
79
|
+
initialInterval: 500,
|
|
80
|
+
maxInterval: 60000,
|
|
81
|
+
exponent: 1.5,
|
|
82
|
+
maxElapsedTime: 3600000,
|
|
83
|
+
},
|
|
84
|
+
retryConnectionErrors: true,
|
|
85
|
+
}
|
|
86
|
+
|| { strategy: "none" },
|
|
87
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
88
|
+
};
|
|
89
|
+
const requestRes = client._createRequest(context, {
|
|
90
|
+
security: requestSecurity,
|
|
91
|
+
method: "POST",
|
|
92
|
+
baseURL: options?.serverURL,
|
|
93
|
+
path: path,
|
|
94
|
+
headers: headers,
|
|
95
|
+
body: body,
|
|
96
|
+
userAgent: client._options.userAgent,
|
|
97
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
98
|
+
}, options);
|
|
99
|
+
if (!requestRes.ok) {
|
|
100
|
+
return [requestRes, { status: "invalid" }];
|
|
101
|
+
}
|
|
102
|
+
const req = requestRes.value;
|
|
103
|
+
const doResult = await client._do(req, {
|
|
104
|
+
context,
|
|
105
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
106
|
+
retryConfig: context.retryConfig,
|
|
107
|
+
retryCodes: context.retryCodes,
|
|
108
|
+
});
|
|
109
|
+
if (!doResult.ok) {
|
|
110
|
+
return [doResult, { status: "request-error", request: req }];
|
|
111
|
+
}
|
|
112
|
+
const response = doResult.value;
|
|
113
|
+
const responseFields = {
|
|
114
|
+
HttpMeta: { Response: response, Request: req },
|
|
115
|
+
};
|
|
116
|
+
const [result] = await M.match(M.sse(200, z.custom(x => x instanceof ReadableStream)
|
|
117
|
+
.transform(stream => {
|
|
118
|
+
return new EventStream(stream, rawEvent => {
|
|
119
|
+
if (rawEvent.data === "[DONE]") {
|
|
120
|
+
return { done: true, value: undefined };
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
done: false,
|
|
124
|
+
value: models.InternChatStreamingResponse$inboundSchema.parse(rawEvent)?.data,
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
})), M.jsonErr([400, 401, 403, 404, 409, 410, 413, 429], errors.InternChatErrorResponse$inboundSchema), M.jsonErr([502, 503, 504], errors.InternChatErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
128
|
+
if (!result.ok) {
|
|
129
|
+
return [result, { status: "complete", request: req, response }];
|
|
130
|
+
}
|
|
131
|
+
return [result, { status: "complete", request: req, response }];
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=internsChat.js.map
|
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.2.
|
|
53
|
+
readonly sdkVersion: "1.2.138";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.138 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.2.
|
|
32
|
+
sdkVersion: "1.2.138",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.2.138 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -22,10 +22,11 @@ export declare const AgentMessageItemDetail: {
|
|
|
22
22
|
};
|
|
23
23
|
export type AgentMessageItemDetail = OpenEnum<typeof AgentMessageItemDetail>;
|
|
24
24
|
/**
|
|
25
|
-
* Image input content item
|
|
25
|
+
* Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.
|
|
26
26
|
*/
|
|
27
27
|
export type AgentMessageItemContentInputImage = {
|
|
28
28
|
detail: AgentMessageItemDetail;
|
|
29
|
+
fileId?: string | null | undefined;
|
|
29
30
|
imageUrl?: string | null | undefined;
|
|
30
31
|
type: "input_image";
|
|
31
32
|
};
|
|
@@ -70,6 +71,7 @@ export declare const AgentMessageItemDetail$outboundSchema: z.ZodType<string, Ag
|
|
|
70
71
|
/** @internal */
|
|
71
72
|
export type AgentMessageItemContentInputImage$Outbound = {
|
|
72
73
|
detail: string;
|
|
74
|
+
file_id?: string | null | undefined;
|
|
73
75
|
image_url?: string | null | undefined;
|
|
74
76
|
type: "input_image";
|
|
75
77
|
};
|
|
@@ -53,10 +53,12 @@ export const AgentMessageItemDetail$outboundSchema = openEnums.outboundSchema(Ag
|
|
|
53
53
|
/** @internal */
|
|
54
54
|
export const AgentMessageItemContentInputImage$outboundSchema = z.object({
|
|
55
55
|
detail: AgentMessageItemDetail$outboundSchema,
|
|
56
|
+
fileId: z.nullable(z.string()).optional(),
|
|
56
57
|
imageUrl: z.nullable(z.string()).optional(),
|
|
57
58
|
type: z.literal("input_image"),
|
|
58
59
|
}).transform((v) => {
|
|
59
60
|
return remap$(v, {
|
|
61
|
+
fileId: "file_id",
|
|
60
62
|
imageUrl: "image_url",
|
|
61
63
|
});
|
|
62
64
|
});
|
|
@@ -10,10 +10,11 @@ export declare const CustomToolCallOutputItemDetail: {
|
|
|
10
10
|
};
|
|
11
11
|
export type CustomToolCallOutputItemDetail = OpenEnum<typeof CustomToolCallOutputItemDetail>;
|
|
12
12
|
/**
|
|
13
|
-
* Image input content item
|
|
13
|
+
* Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.
|
|
14
14
|
*/
|
|
15
15
|
export type CustomToolCallOutputItemOutputInputImage = {
|
|
16
16
|
detail: CustomToolCallOutputItemDetail;
|
|
17
|
+
fileId?: string | null | undefined;
|
|
17
18
|
imageUrl?: string | null | undefined;
|
|
18
19
|
type: "input_image";
|
|
19
20
|
};
|
|
@@ -37,6 +38,7 @@ export declare const CustomToolCallOutputItemDetail$outboundSchema: z.ZodType<st
|
|
|
37
38
|
/** @internal */
|
|
38
39
|
export type CustomToolCallOutputItemOutputInputImage$Outbound = {
|
|
39
40
|
detail: string;
|
|
41
|
+
file_id?: string | null | undefined;
|
|
40
42
|
image_url?: string | null | undefined;
|
|
41
43
|
type: "input_image";
|
|
42
44
|
};
|
|
@@ -21,10 +21,12 @@ export const CustomToolCallOutputItemDetail$outboundSchema = openEnums.outboundS
|
|
|
21
21
|
/** @internal */
|
|
22
22
|
export const CustomToolCallOutputItemOutputInputImage$outboundSchema = z.object({
|
|
23
23
|
detail: CustomToolCallOutputItemDetail$outboundSchema,
|
|
24
|
+
fileId: z.nullable(z.string()).optional(),
|
|
24
25
|
imageUrl: z.nullable(z.string()).optional(),
|
|
25
26
|
type: z.literal("input_image"),
|
|
26
27
|
}).transform((v) => {
|
|
27
28
|
return remap$(v, {
|
|
29
|
+
fileId: "file_id",
|
|
28
30
|
imageUrl: "image_url",
|
|
29
31
|
});
|
|
30
32
|
});
|
|
@@ -12,10 +12,11 @@ export declare const EasyInputMessageDetail: {
|
|
|
12
12
|
};
|
|
13
13
|
export type EasyInputMessageDetail = OpenEnum<typeof EasyInputMessageDetail>;
|
|
14
14
|
/**
|
|
15
|
-
* Image input content item
|
|
15
|
+
* Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.
|
|
16
16
|
*/
|
|
17
17
|
export type EasyInputMessageContentInputImage = {
|
|
18
18
|
detail: EasyInputMessageDetail;
|
|
19
|
+
fileId?: string | null | undefined;
|
|
19
20
|
imageUrl?: string | null | undefined;
|
|
20
21
|
type: "input_image";
|
|
21
22
|
};
|
|
@@ -68,6 +69,7 @@ export declare const EasyInputMessageDetail$outboundSchema: z.ZodType<string, Ea
|
|
|
68
69
|
/** @internal */
|
|
69
70
|
export type EasyInputMessageContentInputImage$Outbound = {
|
|
70
71
|
detail: string;
|
|
72
|
+
file_id?: string | null | undefined;
|
|
71
73
|
image_url?: string | null | undefined;
|
|
72
74
|
type: "input_image";
|
|
73
75
|
};
|
|
@@ -41,10 +41,12 @@ export const EasyInputMessageDetail$outboundSchema = openEnums.outboundSchema(Ea
|
|
|
41
41
|
/** @internal */
|
|
42
42
|
export const EasyInputMessageContentInputImage$outboundSchema = z.object({
|
|
43
43
|
detail: EasyInputMessageDetail$outboundSchema,
|
|
44
|
+
fileId: z.nullable(z.string()).optional(),
|
|
44
45
|
imageUrl: z.nullable(z.string()).optional(),
|
|
45
46
|
type: z.literal("input_image"),
|
|
46
47
|
}).transform((v) => {
|
|
47
48
|
return remap$(v, {
|
|
49
|
+
fileId: "file_id",
|
|
48
50
|
imageUrl: "image_url",
|
|
49
51
|
});
|
|
50
52
|
});
|
|
@@ -7,6 +7,7 @@ export * from "./gatewaytimeoutresponseerror.js";
|
|
|
7
7
|
export * from "./goneresponseerror.js";
|
|
8
8
|
export * from "./httpclienterrors.js";
|
|
9
9
|
export * from "./internalserverresponseerror.js";
|
|
10
|
+
export * from "./internchaterrorresponse.js";
|
|
10
11
|
export * from "./internlifecycleerror.js";
|
|
11
12
|
export * from "./notfoundresponseerror.js";
|
|
12
13
|
export * from "./oautherrorresponse.js";
|
|
@@ -11,6 +11,7 @@ export * from "./gatewaytimeoutresponseerror.js";
|
|
|
11
11
|
export * from "./goneresponseerror.js";
|
|
12
12
|
export * from "./httpclienterrors.js";
|
|
13
13
|
export * from "./internalserverresponseerror.js";
|
|
14
|
+
export * from "./internchaterrorresponse.js";
|
|
14
15
|
export * from "./internlifecycleerror.js";
|
|
15
16
|
export * from "./notfoundresponseerror.js";
|
|
16
17
|
export * from "./oautherrorresponse.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as models from "../index.js";
|
|
3
|
+
import { OpenRouterError } from "./openroutererror.js";
|
|
4
|
+
/**
|
|
5
|
+
* A refusal before the stream opens. Once the response is `200` and streaming, failures arrive as a chunk with `finish_reason: "error"` instead.
|
|
6
|
+
*/
|
|
7
|
+
export type InternChatErrorResponseData = {
|
|
8
|
+
/**
|
|
9
|
+
* The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`.
|
|
10
|
+
*/
|
|
11
|
+
error: models.InternChatError;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A refusal before the stream opens. Once the response is `200` and streaming, failures arrive as a chunk with `finish_reason: "error"` instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare class InternChatErrorResponse extends OpenRouterError {
|
|
17
|
+
/**
|
|
18
|
+
* The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`.
|
|
19
|
+
*/
|
|
20
|
+
error: models.InternChatError;
|
|
21
|
+
/** The original data that was passed to this error instance. */
|
|
22
|
+
data$: InternChatErrorResponseData;
|
|
23
|
+
constructor(err: InternChatErrorResponseData, httpMeta: {
|
|
24
|
+
response: Response;
|
|
25
|
+
request: Request;
|
|
26
|
+
body: string;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare const InternChatErrorResponse$inboundSchema: z.ZodType<InternChatErrorResponse, unknown>;
|
|
31
|
+
//# sourceMappingURL=internchaterrorresponse.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: bb73eae2fe73
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import * as models from "../index.js";
|
|
7
|
+
import { OpenRouterError } from "./openroutererror.js";
|
|
8
|
+
/**
|
|
9
|
+
* A refusal before the stream opens. Once the response is `200` and streaming, failures arrive as a chunk with `finish_reason: "error"` instead.
|
|
10
|
+
*/
|
|
11
|
+
export class InternChatErrorResponse extends OpenRouterError {
|
|
12
|
+
constructor(err, httpMeta) {
|
|
13
|
+
const message = err.error?.message
|
|
14
|
+
|| `API error occurred: ${JSON.stringify(err)}`;
|
|
15
|
+
super(message, httpMeta);
|
|
16
|
+
this.data$ = err;
|
|
17
|
+
this.error = err.error;
|
|
18
|
+
this.name = "InternChatErrorResponse";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const InternChatErrorResponse$inboundSchema = z.object({
|
|
23
|
+
error: models.InternChatError$inboundSchema,
|
|
24
|
+
request$: z.custom(x => x instanceof Request),
|
|
25
|
+
response$: z.custom(x => x instanceof Response),
|
|
26
|
+
body$: z.string(),
|
|
27
|
+
})
|
|
28
|
+
.transform((v) => {
|
|
29
|
+
return new InternChatErrorResponse(v, {
|
|
30
|
+
request: v.request$,
|
|
31
|
+
response: v.response$,
|
|
32
|
+
body: v.body$,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=internchaterrorresponse.js.map
|
|
@@ -11,10 +11,11 @@ export declare const FunctionCallOutputItemDetail: {
|
|
|
11
11
|
};
|
|
12
12
|
export type FunctionCallOutputItemDetail = OpenEnum<typeof FunctionCallOutputItemDetail>;
|
|
13
13
|
/**
|
|
14
|
-
* Image input content item
|
|
14
|
+
* Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.
|
|
15
15
|
*/
|
|
16
16
|
export type FunctionCallOutputItemOutputInputImage = {
|
|
17
17
|
detail: FunctionCallOutputItemDetail;
|
|
18
|
+
fileId?: string | null | undefined;
|
|
18
19
|
imageUrl?: string | null | undefined;
|
|
19
20
|
type: "input_image";
|
|
20
21
|
};
|
|
@@ -39,6 +40,7 @@ export declare const FunctionCallOutputItemDetail$outboundSchema: z.ZodType<stri
|
|
|
39
40
|
/** @internal */
|
|
40
41
|
export type FunctionCallOutputItemOutputInputImage$Outbound = {
|
|
41
42
|
detail: string;
|
|
43
|
+
file_id?: string | null | undefined;
|
|
42
44
|
image_url?: string | null | undefined;
|
|
43
45
|
type: "input_image";
|
|
44
46
|
};
|
|
@@ -22,10 +22,12 @@ export const FunctionCallOutputItemDetail$outboundSchema = openEnums.outboundSch
|
|
|
22
22
|
/** @internal */
|
|
23
23
|
export const FunctionCallOutputItemOutputInputImage$outboundSchema = z.object({
|
|
24
24
|
detail: FunctionCallOutputItemDetail$outboundSchema,
|
|
25
|
+
fileId: z.nullable(z.string()).optional(),
|
|
25
26
|
imageUrl: z.nullable(z.string()).optional(),
|
|
26
27
|
type: z.literal("input_image"),
|
|
27
28
|
}).transform((v) => {
|
|
28
29
|
return remap$(v, {
|
|
30
|
+
fileId: "file_id",
|
|
29
31
|
imageUrl: "image_url",
|
|
30
32
|
});
|
|
31
33
|
});
|
|
@@ -2,16 +2,16 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { OpenEnum } from "../types/enums.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const IncompleteDetailsReason: {
|
|
6
6
|
readonly MaxOutputTokens: "max_output_tokens";
|
|
7
7
|
readonly ContentFilter: "content_filter";
|
|
8
8
|
};
|
|
9
|
-
export type
|
|
9
|
+
export type IncompleteDetailsReason = OpenEnum<typeof IncompleteDetailsReason>;
|
|
10
10
|
export type IncompleteDetails = {
|
|
11
|
-
reason?:
|
|
11
|
+
reason?: IncompleteDetailsReason | undefined;
|
|
12
12
|
};
|
|
13
13
|
/** @internal */
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const IncompleteDetailsReason$inboundSchema: z.ZodType<IncompleteDetailsReason, unknown>;
|
|
15
15
|
/** @internal */
|
|
16
16
|
export declare const IncompleteDetails$inboundSchema: z.ZodType<IncompleteDetails, unknown>;
|
|
17
17
|
export declare function incompleteDetailsFromJSON(jsonString: string): SafeParseResult<IncompleteDetails, SDKValidationError>;
|
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
|
-
export const
|
|
8
|
+
export const IncompleteDetailsReason = {
|
|
9
9
|
MaxOutputTokens: "max_output_tokens",
|
|
10
10
|
ContentFilter: "content_filter",
|
|
11
11
|
};
|
|
12
12
|
/** @internal */
|
|
13
|
-
export const
|
|
14
|
-
.inboundSchema(Reason);
|
|
13
|
+
export const IncompleteDetailsReason$inboundSchema = openEnums.inboundSchema(IncompleteDetailsReason);
|
|
15
14
|
/** @internal */
|
|
16
15
|
export const IncompleteDetails$inboundSchema = z.object({
|
|
17
|
-
reason:
|
|
16
|
+
reason: IncompleteDetailsReason$inboundSchema.optional(),
|
|
18
17
|
});
|
|
19
18
|
export function incompleteDetailsFromJSON(jsonString) {
|
|
20
19
|
return safeParse(jsonString, (x) => IncompleteDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IncompleteDetails' from JSON`);
|
package/esm/models/index.d.ts
CHANGED
|
@@ -308,6 +308,29 @@ export * from "./inputvideo.js";
|
|
|
308
308
|
export * from "./instructtype.js";
|
|
309
309
|
export * from "./intern.js";
|
|
310
310
|
export * from "./internalserverresponseerrordata.js";
|
|
311
|
+
export * from "./internapprovalmode.js";
|
|
312
|
+
export * from "./internchatassistantmessage.js";
|
|
313
|
+
export * from "./internchatchoice.js";
|
|
314
|
+
export * from "./internchatcompletionchunk.js";
|
|
315
|
+
export * from "./internchatcompletionrequest.js";
|
|
316
|
+
export * from "./internchatdelta.js";
|
|
317
|
+
export * from "./internchatdevelopermessage.js";
|
|
318
|
+
export * from "./internchatechoedtoolcall.js";
|
|
319
|
+
export * from "./internchatechoedtoolcallfunction.js";
|
|
320
|
+
export * from "./internchaterror.js";
|
|
321
|
+
export * from "./internchaterrormetadata.js";
|
|
322
|
+
export * from "./internchatmessage.js";
|
|
323
|
+
export * from "./internchatmessagecontent.js";
|
|
324
|
+
export * from "./internchatprompttokensdetails.js";
|
|
325
|
+
export * from "./internchatstreamerror.js";
|
|
326
|
+
export * from "./internchatstreamingresponse.js";
|
|
327
|
+
export * from "./internchatsystemmessage.js";
|
|
328
|
+
export * from "./internchattextpart.js";
|
|
329
|
+
export * from "./internchattoolcall.js";
|
|
330
|
+
export * from "./internchattoolcallfunction.js";
|
|
331
|
+
export * from "./internchattoolmessage.js";
|
|
332
|
+
export * from "./internchatusage.js";
|
|
333
|
+
export * from "./internchatusermessage.js";
|
|
311
334
|
export * from "./internlifecycleerror.js";
|
|
312
335
|
export * from "./internlistresponse.js";
|
|
313
336
|
export * from "./itemreferenceitem.js";
|
package/esm/models/index.js
CHANGED
|
@@ -312,6 +312,29 @@ export * from "./inputvideo.js";
|
|
|
312
312
|
export * from "./instructtype.js";
|
|
313
313
|
export * from "./intern.js";
|
|
314
314
|
export * from "./internalserverresponseerrordata.js";
|
|
315
|
+
export * from "./internapprovalmode.js";
|
|
316
|
+
export * from "./internchatassistantmessage.js";
|
|
317
|
+
export * from "./internchatchoice.js";
|
|
318
|
+
export * from "./internchatcompletionchunk.js";
|
|
319
|
+
export * from "./internchatcompletionrequest.js";
|
|
320
|
+
export * from "./internchatdelta.js";
|
|
321
|
+
export * from "./internchatdevelopermessage.js";
|
|
322
|
+
export * from "./internchatechoedtoolcall.js";
|
|
323
|
+
export * from "./internchatechoedtoolcallfunction.js";
|
|
324
|
+
export * from "./internchaterror.js";
|
|
325
|
+
export * from "./internchaterrormetadata.js";
|
|
326
|
+
export * from "./internchatmessage.js";
|
|
327
|
+
export * from "./internchatmessagecontent.js";
|
|
328
|
+
export * from "./internchatprompttokensdetails.js";
|
|
329
|
+
export * from "./internchatstreamerror.js";
|
|
330
|
+
export * from "./internchatstreamingresponse.js";
|
|
331
|
+
export * from "./internchatsystemmessage.js";
|
|
332
|
+
export * from "./internchattextpart.js";
|
|
333
|
+
export * from "./internchattoolcall.js";
|
|
334
|
+
export * from "./internchattoolcallfunction.js";
|
|
335
|
+
export * from "./internchattoolmessage.js";
|
|
336
|
+
export * from "./internchatusage.js";
|
|
337
|
+
export * from "./internchatusermessage.js";
|
|
315
338
|
export * from "./internlifecycleerror.js";
|
|
316
339
|
export * from "./internlistresponse.js";
|
|
317
340
|
export * from "./itemreferenceitem.js";
|
|
@@ -14,10 +14,11 @@ export declare const InputImageTypeEnum: {
|
|
|
14
14
|
};
|
|
15
15
|
export type InputImageTypeEnum = ClosedEnum<typeof InputImageTypeEnum>;
|
|
16
16
|
/**
|
|
17
|
-
* Image input content item
|
|
17
|
+
* Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.
|
|
18
18
|
*/
|
|
19
19
|
export type InputImage = {
|
|
20
20
|
detail: InputImageDetail;
|
|
21
|
+
fileId?: string | null | undefined;
|
|
21
22
|
imageUrl?: string | null | undefined;
|
|
22
23
|
type: InputImageTypeEnum;
|
|
23
24
|
};
|
|
@@ -34,6 +35,7 @@ export declare const InputImage$inboundSchema: z.ZodType<InputImage, unknown>;
|
|
|
34
35
|
/** @internal */
|
|
35
36
|
export type InputImage$Outbound = {
|
|
36
37
|
detail: string;
|
|
38
|
+
file_id?: string | null | undefined;
|
|
37
39
|
image_url?: string | null | undefined;
|
|
38
40
|
type: string;
|
|
39
41
|
};
|
package/esm/models/inputimage.js
CHANGED
|
@@ -27,20 +27,24 @@ export const InputImageTypeEnum$outboundSchema = InputImageTypeEnum$inboundSchem
|
|
|
27
27
|
export const InputImage$inboundSchema = z
|
|
28
28
|
.object({
|
|
29
29
|
detail: InputImageDetail$inboundSchema,
|
|
30
|
+
file_id: z.nullable(z.string()).optional(),
|
|
30
31
|
image_url: z.nullable(z.string()).optional(),
|
|
31
32
|
type: InputImageTypeEnum$inboundSchema,
|
|
32
33
|
}).transform((v) => {
|
|
33
34
|
return remap$(v, {
|
|
35
|
+
"file_id": "fileId",
|
|
34
36
|
"image_url": "imageUrl",
|
|
35
37
|
});
|
|
36
38
|
});
|
|
37
39
|
/** @internal */
|
|
38
40
|
export const InputImage$outboundSchema = z.object({
|
|
39
41
|
detail: InputImageDetail$outboundSchema,
|
|
42
|
+
fileId: z.nullable(z.string()).optional(),
|
|
40
43
|
imageUrl: z.nullable(z.string()).optional(),
|
|
41
44
|
type: InputImageTypeEnum$outboundSchema,
|
|
42
45
|
}).transform((v) => {
|
|
43
46
|
return remap$(v, {
|
|
47
|
+
fileId: "file_id",
|
|
44
48
|
imageUrl: "image_url",
|
|
45
49
|
});
|
|
46
50
|
});
|
|
@@ -12,10 +12,11 @@ export declare const InputMessageItemDetail: {
|
|
|
12
12
|
};
|
|
13
13
|
export type InputMessageItemDetail = OpenEnum<typeof InputMessageItemDetail>;
|
|
14
14
|
/**
|
|
15
|
-
* Image input content item
|
|
15
|
+
* Image input content item. Provide either an image_url (a URL or a base64 data URL) or the file_id of an uploaded image.
|
|
16
16
|
*/
|
|
17
17
|
export type InputMessageItemContentInputImage = {
|
|
18
18
|
detail: InputMessageItemDetail;
|
|
19
|
+
fileId?: string | null | undefined;
|
|
19
20
|
imageUrl?: string | null | undefined;
|
|
20
21
|
type: "input_image";
|
|
21
22
|
};
|
|
@@ -48,6 +49,7 @@ export declare const InputMessageItemDetail$outboundSchema: z.ZodType<string, In
|
|
|
48
49
|
/** @internal */
|
|
49
50
|
export type InputMessageItemContentInputImage$Outbound = {
|
|
50
51
|
detail: string;
|
|
52
|
+
file_id?: string | null | undefined;
|
|
51
53
|
image_url?: string | null | undefined;
|
|
52
54
|
type: "input_image";
|
|
53
55
|
};
|
|
@@ -32,10 +32,12 @@ export const InputMessageItemDetail$outboundSchema = openEnums.outboundSchema(In
|
|
|
32
32
|
/** @internal */
|
|
33
33
|
export const InputMessageItemContentInputImage$outboundSchema = z.object({
|
|
34
34
|
detail: InputMessageItemDetail$outboundSchema,
|
|
35
|
+
fileId: z.nullable(z.string()).optional(),
|
|
35
36
|
imageUrl: z.nullable(z.string()).optional(),
|
|
36
37
|
type: z.literal("input_image"),
|
|
37
38
|
}).transform((v) => {
|
|
38
39
|
return remap$(v, {
|
|
40
|
+
fileId: "file_id",
|
|
39
41
|
imageUrl: "image_url",
|
|
40
42
|
});
|
|
41
43
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.
|
|
5
|
+
*/
|
|
6
|
+
export declare const InternApprovalMode: {
|
|
7
|
+
readonly Manual: "manual";
|
|
8
|
+
readonly SelfDrive: "self-drive";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.
|
|
12
|
+
*/
|
|
13
|
+
export type InternApprovalMode = OpenEnum<typeof InternApprovalMode>;
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const InternApprovalMode$outboundSchema: z.ZodType<string, InternApprovalMode>;
|
|
16
|
+
//# sourceMappingURL=internapprovalmode.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: cccfde70a06c
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
/**
|
|
7
|
+
* How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.
|
|
8
|
+
*/
|
|
9
|
+
export const InternApprovalMode = {
|
|
10
|
+
Manual: "manual",
|
|
11
|
+
SelfDrive: "self-drive",
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const InternApprovalMode$outboundSchema = openEnums.outboundSchema(InternApprovalMode);
|
|
15
|
+
//# sourceMappingURL=internapprovalmode.js.map
|