sarvamai 1.1.16-alpha.3 → 1.1.17
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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/chat/client/Client.js +8 -0
- package/dist/cjs/api/resources/chat/client/requests/CreateChatCompletionV2Request.d.ts +3 -3
- package/dist/cjs/api/resources/decisions/client/Client.d.ts +12 -4
- package/dist/cjs/api/resources/decisions/client/Client.js +12 -4
- package/dist/cjs/api/resources/responses/client/Client.js +4 -0
- package/dist/cjs/api/resources/responses/client/requests/ResponsesCreateRequest.d.ts +5 -1
- package/dist/cjs/api/resources/responses/client/requests/ResponsesCreateStreamRequest.d.ts +5 -1
- package/dist/cjs/api/types/Choice.d.ts +1 -1
- package/dist/cjs/api/types/CreateResponseV2Request.d.ts +5 -1
- package/dist/cjs/api/types/ModelObject.d.ts +10 -0
- package/dist/cjs/api/types/ModelObject.js +9 -0
- package/dist/cjs/api/types/ReasoningEffort.d.ts +2 -1
- package/dist/cjs/api/types/ReasoningEffort.js +2 -1
- package/dist/cjs/api/types/ResponseReasoning.d.ts +1 -1
- package/dist/cjs/api/types/ResponseReasoningEffort.d.ts +2 -1
- package/dist/cjs/api/types/ResponseReasoningEffort.js +2 -1
- package/dist/cjs/api/types/ResponsesModelIds.d.ts +7 -1
- package/dist/cjs/api/types/ResponsesModelIds.js +7 -1
- package/dist/cjs/api/types/V2ModelIds.d.ts +8 -2
- package/dist/cjs/api/types/V2ModelIds.js +8 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/chat/client/Client.mjs +8 -0
- package/dist/esm/api/resources/chat/client/requests/CreateChatCompletionV2Request.d.mts +3 -3
- package/dist/esm/api/resources/decisions/client/Client.d.mts +12 -4
- package/dist/esm/api/resources/decisions/client/Client.mjs +12 -4
- package/dist/esm/api/resources/responses/client/Client.mjs +4 -0
- package/dist/esm/api/resources/responses/client/requests/ResponsesCreateRequest.d.mts +5 -1
- package/dist/esm/api/resources/responses/client/requests/ResponsesCreateStreamRequest.d.mts +5 -1
- package/dist/esm/api/types/Choice.d.mts +1 -1
- package/dist/esm/api/types/CreateResponseV2Request.d.mts +5 -1
- package/dist/esm/api/types/ModelObject.d.mts +10 -0
- package/dist/esm/api/types/ModelObject.mjs +8 -1
- package/dist/esm/api/types/ReasoningEffort.d.mts +2 -1
- package/dist/esm/api/types/ReasoningEffort.mjs +2 -1
- package/dist/esm/api/types/ResponseReasoning.d.mts +1 -1
- package/dist/esm/api/types/ResponseReasoningEffort.d.mts +2 -1
- package/dist/esm/api/types/ResponseReasoningEffort.mjs +2 -1
- package/dist/esm/api/types/ResponsesModelIds.d.mts +7 -1
- package/dist/esm/api/types/ResponsesModelIds.mjs +7 -1
- package/dist/esm/api/types/V2ModelIds.d.mts +8 -2
- package/dist/esm/api/types/V2ModelIds.mjs +8 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +14 -6
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "sarvamai",
|
|
46
|
-
"X-Fern-SDK-Version": "1.1.
|
|
47
|
-
"User-Agent": "sarvamai/1.1.
|
|
46
|
+
"X-Fern-SDK-Version": "1.1.17",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.17",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -341,8 +341,12 @@ class ChatClient {
|
|
|
341
341
|
throw new SarvamAI.BadRequestError(body, rawResponse);
|
|
342
342
|
case 401:
|
|
343
343
|
throw new SarvamAI.UnauthorizedError(body, rawResponse);
|
|
344
|
+
case 402:
|
|
345
|
+
throw new SarvamAI.PaymentRequiredError(body, rawResponse);
|
|
344
346
|
case 403:
|
|
345
347
|
throw new SarvamAI.ForbiddenError(body, rawResponse);
|
|
348
|
+
case 404:
|
|
349
|
+
throw new SarvamAI.NotFoundError(body, rawResponse);
|
|
346
350
|
case 413:
|
|
347
351
|
throw new SarvamAI.ContentTooLargeError(body, rawResponse);
|
|
348
352
|
case 422:
|
|
@@ -351,8 +355,12 @@ class ChatClient {
|
|
|
351
355
|
throw new SarvamAI.TooManyRequestsError(body, rawResponse);
|
|
352
356
|
case 500:
|
|
353
357
|
throw new SarvamAI.InternalServerError(body, rawResponse);
|
|
358
|
+
case 502:
|
|
359
|
+
throw new SarvamAI.BadGatewayError(body, rawResponse);
|
|
354
360
|
case 503:
|
|
355
361
|
throw new SarvamAI.ServiceUnavailableError(body, rawResponse);
|
|
362
|
+
case 504:
|
|
363
|
+
throw new SarvamAI.GatewayTimeoutError(body, rawResponse);
|
|
356
364
|
default:
|
|
357
365
|
throw new errors.SarvamAIError({
|
|
358
366
|
statusCode,
|
|
@@ -20,7 +20,7 @@ export interface CreateChatCompletionV2Request {
|
|
|
20
20
|
temperature?: number;
|
|
21
21
|
/** Nucleus sampling: greater than `0` and at most `1`. On `glm5.3`, `top_p: 0` is rejected. Prefer changing either `top_p` or `temperature`, not both. */
|
|
22
22
|
top_p?: number;
|
|
23
|
-
/** On reasoning models
|
|
23
|
+
/** On reasoning models: **`low`**, **`high`**, or **`max`** on every reasoning model, and **`medium`** on `sarvam-105b`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `kimi-k3.1-pro`, and `qwen38-27b` (`kimi-k3.1-pro` runs `medium` as `high`). Default when omitted is **`max`** on `glm5.3` and `kimi-k3.1-pro`, **`high`** on `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, and no reasoning on `gemma4`; `qwen38-27b` thinks by default. **`none`** turns thinking off on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`. `kimi-k3.1-pro` always thinks: `none`, `minimal`, and `xhigh` return `400`. Trace in `message.reasoning_content`; billed as completion tokens and counts toward `max_tokens`. On `gemma4`, reasoning is off unless this is set (`low`, `high`, or `max`). */
|
|
24
24
|
reasoning_effort?: SarvamAI.ReasoningEffort;
|
|
25
25
|
/** Maximum tokens to generate in the completion, including reasoning tokens on reasoning models. Default `2048`. Set explicitly when you need longer answers — a low limit can yield `finish_reason: "length"` with little or no visible `content` if reasoning consumes the budget. */
|
|
26
26
|
max_tokens?: number;
|
|
@@ -59,8 +59,8 @@ export interface CreateChatCompletionV2Request {
|
|
|
59
59
|
parallel_tool_calls?: boolean;
|
|
60
60
|
/** Only valid with `stream: true` (otherwise `400`). Must be a top-level field, not inside `extra_body`. Use `{"include_usage": true}` to receive token usage in the final SSE chunk. */
|
|
61
61
|
stream_options?: SarvamAI.ChatStreamOptions;
|
|
62
|
-
/** If `true`, return log probabilities for output tokens (use with `top_logprobs`). Supported on **`sarvam-105b`**, **`gemma4`**, **`glm5.3-flash`**, **`deepseekv4.1-flash-1017`**, **`deepseekv4-pro`**, and **`
|
|
62
|
+
/** If `true`, return log probabilities for output tokens (use with `top_logprobs`). Supported on **`sarvam-105b`**, **`gemma4`**, **`glm5.3-flash`**, **`deepseekv4.1-flash-1017`**, **`deepseekv4.1-flash-1017-interactive`**, **`deepseekv4-pro`**, and **`qwen38-27b`**. Not supported on **`glm5.3`** or **`kimi-k3.1-pro`** (`400` if enabled). */
|
|
63
63
|
logprobs?: boolean;
|
|
64
|
-
/** How many top token log probabilities to return at each position. Takes effect only when `logprobs` is `true`; without it, some models ignore the field and others return **`400`**. Same model support as `logprobs`: works on `sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4-pro`, and `
|
|
64
|
+
/** How many top token log probabilities to return at each position. Takes effect only when `logprobs` is `true`; without it, some models ignore the field and others return **`400`**. Same model support as `logprobs`: works on `sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; on `glm5.3` and `kimi-k3.1-pro`, omit entirely — do not send `0`, since many SDKs add it by default. */
|
|
65
65
|
top_logprobs?: number;
|
|
66
66
|
}
|
|
@@ -11,17 +11,25 @@ export declare class DecisionsClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<DecisionsClient.Options>;
|
|
12
12
|
constructor(options?: DecisionsClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
14
|
+
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
15
|
+
*
|
|
16
|
+
* **Models:** `sarvam-prism` (serverless) and `clef` (Provisioned Throughput; also reads images).
|
|
15
17
|
*
|
|
16
18
|
* Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
|
|
17
19
|
*
|
|
18
20
|
* **Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
|
|
19
21
|
*
|
|
20
|
-
* **Repeatability:** probabilities can vary slightly between identical requests
|
|
22
|
+
* **Repeatability:** on `sarvam-prism`, probabilities can vary slightly between identical requests and the top answer is stable; the order of `choice` options does not affect the answer. On `clef`, identical requests return identical probabilities.
|
|
23
|
+
*
|
|
24
|
+
* **Images:** `clef` reads base64 images in `images`; image URLs return `400`. `sarvam-prism` refuses `images` (image URLs return `400`, inline images `422`).
|
|
25
|
+
*
|
|
26
|
+
* **Not supported:** streaming. `temperature` returns `422` on both models. `sarvam-prism` also refuses `max_tokens` and `stream` with `422`; `clef` accepts and ignores them. Unknown keys inside a question return `422`.
|
|
21
27
|
*
|
|
22
|
-
* **
|
|
28
|
+
* **Limits:**
|
|
29
|
+
* - `sarvam-prism`: 32,768 tokens per question (state + question + options), 2–255 options per `choice`, and 2–10 levels per `score`. If any one question breaks a limit, the whole request fails with `422`.
|
|
30
|
+
* - `clef`: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per `choice`, and 1–10 levels per `score`. A longer request fails with `400`.
|
|
23
31
|
*
|
|
24
|
-
*
|
|
32
|
+
* There is no cap on the number of questions, and the state is never truncated.
|
|
25
33
|
*
|
|
26
34
|
* **Timeout:** each request must finish within 60 seconds. A longer request fails with `503 model_overloaded`; split very large batches across several requests before retrying.
|
|
27
35
|
*
|
|
@@ -56,17 +56,25 @@ class DecisionsClient {
|
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
59
|
+
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
60
|
+
*
|
|
61
|
+
* **Models:** `sarvam-prism` (serverless) and `clef` (Provisioned Throughput; also reads images).
|
|
60
62
|
*
|
|
61
63
|
* Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
|
|
62
64
|
*
|
|
63
65
|
* **Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
|
|
64
66
|
*
|
|
65
|
-
* **Repeatability:** probabilities can vary slightly between identical requests
|
|
67
|
+
* **Repeatability:** on `sarvam-prism`, probabilities can vary slightly between identical requests and the top answer is stable; the order of `choice` options does not affect the answer. On `clef`, identical requests return identical probabilities.
|
|
68
|
+
*
|
|
69
|
+
* **Images:** `clef` reads base64 images in `images`; image URLs return `400`. `sarvam-prism` refuses `images` (image URLs return `400`, inline images `422`).
|
|
70
|
+
*
|
|
71
|
+
* **Not supported:** streaming. `temperature` returns `422` on both models. `sarvam-prism` also refuses `max_tokens` and `stream` with `422`; `clef` accepts and ignores them. Unknown keys inside a question return `422`.
|
|
66
72
|
*
|
|
67
|
-
* **
|
|
73
|
+
* **Limits:**
|
|
74
|
+
* - `sarvam-prism`: 32,768 tokens per question (state + question + options), 2–255 options per `choice`, and 2–10 levels per `score`. If any one question breaks a limit, the whole request fails with `422`.
|
|
75
|
+
* - `clef`: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per `choice`, and 1–10 levels per `score`. A longer request fails with `400`.
|
|
68
76
|
*
|
|
69
|
-
*
|
|
77
|
+
* There is no cap on the number of questions, and the state is never truncated.
|
|
70
78
|
*
|
|
71
79
|
* **Timeout:** each request must finish within 60 seconds. A longer request fails with `503 model_overloaded`; split very large batches across several requests before retrying.
|
|
72
80
|
*
|
|
@@ -175,6 +175,8 @@ class ResponsesClient {
|
|
|
175
175
|
throw new SarvamAI.BadRequestError(body, rawResponse);
|
|
176
176
|
case 401:
|
|
177
177
|
throw new SarvamAI.UnauthorizedError(body, rawResponse);
|
|
178
|
+
case 402:
|
|
179
|
+
throw new SarvamAI.PaymentRequiredError(body, rawResponse);
|
|
178
180
|
case 403:
|
|
179
181
|
throw new SarvamAI.ForbiddenError(body, rawResponse);
|
|
180
182
|
case 404:
|
|
@@ -221,6 +223,8 @@ class ResponsesClient {
|
|
|
221
223
|
throw new SarvamAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
222
224
|
case 401:
|
|
223
225
|
throw new SarvamAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
226
|
+
case 402:
|
|
227
|
+
throw new SarvamAI.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
224
228
|
case 403:
|
|
225
229
|
throw new SarvamAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
226
230
|
case 404:
|
|
@@ -19,7 +19,7 @@ export interface ResponsesCreateRequest {
|
|
|
19
19
|
tools?: SarvamAI.ResponseFunctionTool[];
|
|
20
20
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
21
21
|
tool_choice?: ResponsesCreateRequest.ToolChoice;
|
|
22
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
22
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
23
23
|
reasoning?: SarvamAI.ResponseReasoning;
|
|
24
24
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
25
25
|
extra_body?: Record<string, unknown>;
|
|
@@ -48,6 +48,10 @@ export interface ResponsesCreateRequest {
|
|
|
48
48
|
background?: boolean;
|
|
49
49
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
50
50
|
max_tool_calls?: number;
|
|
51
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
52
|
+
top_logprobs?: number;
|
|
53
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
54
|
+
include?: string[];
|
|
51
55
|
/** Accepts any additional properties */
|
|
52
56
|
[key: string]: any;
|
|
53
57
|
}
|
|
@@ -19,7 +19,7 @@ export interface ResponsesCreateStreamRequest {
|
|
|
19
19
|
tools?: SarvamAI.ResponseFunctionTool[];
|
|
20
20
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
21
21
|
tool_choice?: ResponsesCreateStreamRequest.ToolChoice;
|
|
22
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
22
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
23
23
|
reasoning?: SarvamAI.ResponseReasoning;
|
|
24
24
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
25
25
|
extra_body?: Record<string, unknown>;
|
|
@@ -48,6 +48,10 @@ export interface ResponsesCreateStreamRequest {
|
|
|
48
48
|
background?: boolean;
|
|
49
49
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
50
50
|
max_tool_calls?: number;
|
|
51
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
52
|
+
top_logprobs?: number;
|
|
53
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
54
|
+
include?: string[];
|
|
51
55
|
/** Accepts any additional properties */
|
|
52
56
|
[key: string]: any;
|
|
53
57
|
}
|
|
@@ -9,7 +9,7 @@ export interface Choice {
|
|
|
9
9
|
finish_reason: SarvamAI.FinishReason;
|
|
10
10
|
/** The index of the choice in the list of choices. */
|
|
11
11
|
index: number;
|
|
12
|
-
/** Token log probabilities when supported (`sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4-
|
|
12
|
+
/** Token log probabilities when supported (`sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `qwen38-27b`). Not supported on `glm5.3` or `kimi-k3.1-pro`, which return `400` when `logprobs` is set. */
|
|
13
13
|
logprobs?: Record<string, unknown> | undefined;
|
|
14
14
|
message: SarvamAI.ChatCompletionResponseMessage;
|
|
15
15
|
}
|
|
@@ -14,7 +14,7 @@ export interface CreateResponseV2Request {
|
|
|
14
14
|
tools?: SarvamAI.ResponseFunctionTool[] | undefined;
|
|
15
15
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
16
16
|
tool_choice?: CreateResponseV2Request.ToolChoice | undefined;
|
|
17
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
17
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
18
18
|
reasoning?: SarvamAI.ResponseReasoning | undefined;
|
|
19
19
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
20
20
|
extra_body?: Record<string, unknown> | undefined;
|
|
@@ -43,6 +43,10 @@ export interface CreateResponseV2Request {
|
|
|
43
43
|
background?: boolean | undefined;
|
|
44
44
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
45
45
|
max_tool_calls?: number | undefined;
|
|
46
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
47
|
+
top_logprobs?: number | undefined;
|
|
48
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
49
|
+
include?: string[] | undefined;
|
|
46
50
|
/** Accepts any additional properties */
|
|
47
51
|
[key: string]: any;
|
|
48
52
|
}
|
|
@@ -3,4 +3,14 @@ export interface ModelObject {
|
|
|
3
3
|
object?: "model" | undefined;
|
|
4
4
|
created: number;
|
|
5
5
|
owned_by: string;
|
|
6
|
+
/** How the model is offered. `"provisioned"`: Provisioned Throughput, enabled per organisation (without access, `deepseekv4-pro` returns `400` and the others return `404` and aren't listed). `"standard"`: serverless, any API key can call it. */
|
|
7
|
+
access?: ModelObject.Access | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace ModelObject {
|
|
10
|
+
/** How the model is offered. `"provisioned"`: Provisioned Throughput, enabled per organisation (without access, `deepseekv4-pro` returns `400` and the others return `404` and aren't listed). `"standard"`: serverless, any API key can call it. */
|
|
11
|
+
const Access: {
|
|
12
|
+
readonly Standard: "standard";
|
|
13
|
+
readonly Provisioned: "provisioned";
|
|
14
|
+
};
|
|
15
|
+
type Access = (typeof Access)[keyof typeof Access];
|
|
6
16
|
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ModelObject = void 0;
|
|
5
|
+
var ModelObject;
|
|
6
|
+
(function (ModelObject) {
|
|
7
|
+
/** How the model is offered. `"provisioned"`: Provisioned Throughput, enabled per organisation (without access, `deepseekv4-pro` returns `400` and the others return `404` and aren't listed). `"standard"`: serverless, any API key can call it. */
|
|
8
|
+
ModelObject.Access = {
|
|
9
|
+
Standard: "standard",
|
|
10
|
+
Provisioned: "provisioned",
|
|
11
|
+
};
|
|
12
|
+
})(ModelObject || (exports.ModelObject = ModelObject = {}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/** Reasoning depth on `
|
|
1
|
+
/** Reasoning depth. `low`, `high`, and `max` work on every reasoning model; `medium` also works on `sarvam-105b`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `kimi-k3.1-pro`, and `qwen38-27b`. Default when omitted is `max` on `glm5.3` and `kimi-k3.1-pro`, `high` on `glm5.3-flash` and the DeepSeek models, and no reasoning on `gemma4`. `none` turns thinking off on the DeepSeek models and `qwen38-27b`; `kimi-k3.1-pro` refuses it, and other models reject it or keep thinking. */
|
|
2
2
|
export declare const ReasoningEffort: {
|
|
3
3
|
readonly None: "none";
|
|
4
4
|
readonly Low: "low";
|
|
5
|
+
readonly Medium: "medium";
|
|
5
6
|
readonly High: "high";
|
|
6
7
|
readonly Max: "max";
|
|
7
8
|
};
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ReasoningEffort = void 0;
|
|
5
|
-
/** Reasoning depth on `
|
|
5
|
+
/** Reasoning depth. `low`, `high`, and `max` work on every reasoning model; `medium` also works on `sarvam-105b`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `kimi-k3.1-pro`, and `qwen38-27b`. Default when omitted is `max` on `glm5.3` and `kimi-k3.1-pro`, `high` on `glm5.3-flash` and the DeepSeek models, and no reasoning on `gemma4`. `none` turns thinking off on the DeepSeek models and `qwen38-27b`; `kimi-k3.1-pro` refuses it, and other models reject it or keep thinking. */
|
|
6
6
|
exports.ReasoningEffort = {
|
|
7
7
|
None: "none",
|
|
8
8
|
Low: "low",
|
|
9
|
+
Medium: "medium",
|
|
9
10
|
High: "high",
|
|
10
11
|
Max: "max",
|
|
11
12
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as SarvamAI from "../index.js";
|
|
2
2
|
export interface ResponseReasoning {
|
|
3
|
-
/** `low`, `high`, or `max
|
|
3
|
+
/** `low`, `high`, or `max`, plus `medium` and `none` on some models. On **`glm5.3`** and **`glm5.3-flash`**, sending the literal string `max` returns `400`; omitting the field gives `max` on `glm5.3` and `high` on `glm5.3-flash`. **`deepseekv4.1-flash-1017`**, **`deepseekv4.1-flash-1017-interactive`**, and **`deepseekv4-pro`** accept `max` directly, and `none` turns thinking off. **`kimi-k3.1-pro`** accepts `low`, `medium`, `high`, or `max` and always thinks. **`qwen38-27b`** thinks by default; `none` turns it off. `gemma4` accepts `low` or `high`; omitting it means no reasoning. */
|
|
4
4
|
effort?: SarvamAI.ResponseReasoningEffort | undefined;
|
|
5
5
|
/** `auto` or `detailed`. Without it, the reasoning item's `summary` is empty; read the trace from `content[0].text`. */
|
|
6
6
|
summary?: ResponseReasoning.Summary | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/** Reasoning effort on the Responses route. `deepseekv4.1-flash-1017`, `deepseekv4-pro`, and `kimi-k3.1-pro`
|
|
1
|
+
/** Reasoning effort on the Responses route. `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro` accept `low`, `high`, and `max` directly, and `none` turns thinking off. `kimi-k3.1-pro` accepts `low`, `medium`, `high`, and `max` and always thinks. `qwen38-27b` thinks by default; `none` turns it off. `glm5.3` and `glm5.3-flash` accept `low` and `high`; the literal string `max` returns `400` on them. Omitting the field gives `max` on `glm5.3` and `high` on `glm5.3-flash`. `gemma4` accepts `low` or `high`; omitting the field means no reasoning. */
|
|
2
2
|
export declare const ResponseReasoningEffort: {
|
|
3
3
|
readonly None: "none";
|
|
4
4
|
readonly Low: "low";
|
|
5
|
+
readonly Medium: "medium";
|
|
5
6
|
readonly High: "high";
|
|
6
7
|
readonly Max: "max";
|
|
7
8
|
};
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ResponseReasoningEffort = void 0;
|
|
5
|
-
/** Reasoning effort on the Responses route. `deepseekv4.1-flash-1017`, `deepseekv4-pro`, and `kimi-k3.1-pro`
|
|
5
|
+
/** Reasoning effort on the Responses route. `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro` accept `low`, `high`, and `max` directly, and `none` turns thinking off. `kimi-k3.1-pro` accepts `low`, `medium`, `high`, and `max` and always thinks. `qwen38-27b` thinks by default; `none` turns it off. `glm5.3` and `glm5.3-flash` accept `low` and `high`; the literal string `max` returns `400` on them. Omitting the field gives `max` on `glm5.3` and `high` on `glm5.3-flash`. `gemma4` accepts `low` or `high`; omitting the field means no reasoning. */
|
|
6
6
|
exports.ResponseReasoningEffort = {
|
|
7
7
|
None: "none",
|
|
8
8
|
Low: "low",
|
|
9
|
+
Medium: "medium",
|
|
9
10
|
High: "high",
|
|
10
11
|
Max: "max",
|
|
11
12
|
};
|
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
* Model IDs accepted by `POST /v2/responses` (case-sensitive; unknown ids return `404`):
|
|
3
3
|
*
|
|
4
4
|
* - **`sarvam-105b`** — Sarvam flagship model.
|
|
5
|
+
* - **`sarvam-105b-conversations`** — Sarvam 105B tuned for real-time dialogue.
|
|
5
6
|
* - **`glm5.3`** — 1,048,576-token context; reasoning in `output` as a `reasoning` item; flat function tools; max request size 10,485,760 bytes.
|
|
6
7
|
* - **`glm5.3-flash`** — long context, vision (inline base64 images), tools, and reasoning; `reasoning.effort` accepts `low` or `high` only, as on `glm5.3`.
|
|
7
8
|
* - **`gemma4`** — 262,144-token context, vision (inline base64 images), tools, and optional reasoning (`reasoning.effort` `low` or `high`).
|
|
8
|
-
* - **`deepseekv4.1-flash-1017`** — long context, tools, and reasoning.
|
|
9
|
+
* - **`deepseekv4.1-flash-1017`** — long context, vision (inline base64 images), tools, and reasoning.
|
|
10
|
+
* - **`deepseekv4.1-flash-1017-interactive`** — same capabilities as `deepseekv4.1-flash-1017`, on a high-throughput deployment (more than 200 output tokens per second).
|
|
9
11
|
* - **`deepseekv4-pro`** (Provisioned Throughput) — long context, text input, tools, and reasoning (default `high`).
|
|
10
12
|
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — long context, image input (inline base64; no video on this route), tools, and reasoning (always on).
|
|
13
|
+
* - **`qwen38-27b`** (Provisioned Throughput) — 262,144-token context, image input (inline base64), tools, and reasoning (on by default).
|
|
11
14
|
*/
|
|
12
15
|
export declare const ResponsesModelIds: {
|
|
13
16
|
readonly Sarvam105B: "sarvam-105b";
|
|
17
|
+
readonly Sarvam105BConversations: "sarvam-105b-conversations";
|
|
14
18
|
readonly Glm53: "glm5.3";
|
|
15
19
|
readonly Glm53Flash: "glm5.3-flash";
|
|
16
20
|
readonly Gemma4: "gemma4";
|
|
17
21
|
readonly Deepseekv41Flash1017: "deepseekv4.1-flash-1017";
|
|
22
|
+
readonly Deepseekv41Flash1017Interactive: "deepseekv4.1-flash-1017-interactive";
|
|
18
23
|
readonly Deepseekv4Pro: "deepseekv4-pro";
|
|
19
24
|
readonly KimiK31Pro: "kimi-k3.1-pro";
|
|
25
|
+
readonly Qwen3827B: "qwen38-27b";
|
|
20
26
|
};
|
|
21
27
|
export type ResponsesModelIds = (typeof ResponsesModelIds)[keyof typeof ResponsesModelIds];
|
|
@@ -6,19 +6,25 @@ exports.ResponsesModelIds = void 0;
|
|
|
6
6
|
* Model IDs accepted by `POST /v2/responses` (case-sensitive; unknown ids return `404`):
|
|
7
7
|
*
|
|
8
8
|
* - **`sarvam-105b`** — Sarvam flagship model.
|
|
9
|
+
* - **`sarvam-105b-conversations`** — Sarvam 105B tuned for real-time dialogue.
|
|
9
10
|
* - **`glm5.3`** — 1,048,576-token context; reasoning in `output` as a `reasoning` item; flat function tools; max request size 10,485,760 bytes.
|
|
10
11
|
* - **`glm5.3-flash`** — long context, vision (inline base64 images), tools, and reasoning; `reasoning.effort` accepts `low` or `high` only, as on `glm5.3`.
|
|
11
12
|
* - **`gemma4`** — 262,144-token context, vision (inline base64 images), tools, and optional reasoning (`reasoning.effort` `low` or `high`).
|
|
12
|
-
* - **`deepseekv4.1-flash-1017`** — long context, tools, and reasoning.
|
|
13
|
+
* - **`deepseekv4.1-flash-1017`** — long context, vision (inline base64 images), tools, and reasoning.
|
|
14
|
+
* - **`deepseekv4.1-flash-1017-interactive`** — same capabilities as `deepseekv4.1-flash-1017`, on a high-throughput deployment (more than 200 output tokens per second).
|
|
13
15
|
* - **`deepseekv4-pro`** (Provisioned Throughput) — long context, text input, tools, and reasoning (default `high`).
|
|
14
16
|
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — long context, image input (inline base64; no video on this route), tools, and reasoning (always on).
|
|
17
|
+
* - **`qwen38-27b`** (Provisioned Throughput) — 262,144-token context, image input (inline base64), tools, and reasoning (on by default).
|
|
15
18
|
*/
|
|
16
19
|
exports.ResponsesModelIds = {
|
|
17
20
|
Sarvam105B: "sarvam-105b",
|
|
21
|
+
Sarvam105BConversations: "sarvam-105b-conversations",
|
|
18
22
|
Glm53: "glm5.3",
|
|
19
23
|
Glm53Flash: "glm5.3-flash",
|
|
20
24
|
Gemma4: "gemma4",
|
|
21
25
|
Deepseekv41Flash1017: "deepseekv4.1-flash-1017",
|
|
26
|
+
Deepseekv41Flash1017Interactive: "deepseekv4.1-flash-1017-interactive",
|
|
22
27
|
Deepseekv4Pro: "deepseekv4-pro",
|
|
23
28
|
KimiK31Pro: "kimi-k3.1-pro",
|
|
29
|
+
Qwen3827B: "qwen38-27b",
|
|
24
30
|
};
|
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
* Model IDs accepted by `POST /v2/chat/completions` (case-sensitive; unknown ids return `404`):
|
|
3
3
|
*
|
|
4
4
|
* - **`sarvam-105b`** — Sarvam flagship chat model.
|
|
5
|
+
* - **`sarvam-105b-conversations`** — Sarvam 105B tuned for real-time dialogue and voice agents; 32,000-token context window.
|
|
5
6
|
* - **`glm5.3`** — 1,048,576-token context window; visible reasoning in `reasoning_content` (billed as completion tokens); tool calling; max request size 10,485,760 bytes; `n` must be `1`.
|
|
6
7
|
* - **`glm5.3-flash`** — 1,048,576-token context window, image input (inline base64), tool calling, and reasoning (on by default).
|
|
7
8
|
* - **`gemma4`** — 262,144-token context window, image input (inline base64), tool calling, and optional reasoning (`reasoning_effort`).
|
|
8
|
-
* - **`deepseekv4.1-flash-1017`** — 1,048,576-token context window, tool calling, and reasoning.
|
|
9
|
+
* - **`deepseekv4.1-flash-1017`** — 1,048,576-token context window, image input (inline base64), tool calling, and reasoning.
|
|
10
|
+
* - **`deepseekv4.1-flash-1017-interactive`** — the same model on a high-throughput deployment: more than 200 output tokens per second, against about 80; same capabilities as `deepseekv4.1-flash-1017`.
|
|
9
11
|
* - **`deepseekv4-pro`** (Provisioned Throughput) — 1,000,000-token context window; text input only; tool calling; reasoning (default `high`; `none` turns it off).
|
|
10
|
-
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — 1,048,576-token context window; image
|
|
12
|
+
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — 1,048,576-token context window; image and video input (inline base64); tool calling; reasoning is always on (default `max`).
|
|
13
|
+
* - **`qwen38-27b`** (Provisioned Throughput) — 262,144-token context window; image input (inline base64); tool calling; reasoning on by default (`none` turns it off).
|
|
11
14
|
*/
|
|
12
15
|
export declare const V2ModelIds: {
|
|
13
16
|
readonly Sarvam105B: "sarvam-105b";
|
|
17
|
+
readonly Sarvam105BConversations: "sarvam-105b-conversations";
|
|
14
18
|
readonly Glm53: "glm5.3";
|
|
15
19
|
readonly Glm53Flash: "glm5.3-flash";
|
|
16
20
|
readonly Gemma4: "gemma4";
|
|
17
21
|
readonly Deepseekv41Flash1017: "deepseekv4.1-flash-1017";
|
|
22
|
+
readonly Deepseekv41Flash1017Interactive: "deepseekv4.1-flash-1017-interactive";
|
|
18
23
|
readonly Deepseekv4Pro: "deepseekv4-pro";
|
|
19
24
|
readonly KimiK31Pro: "kimi-k3.1-pro";
|
|
25
|
+
readonly Qwen3827B: "qwen38-27b";
|
|
20
26
|
};
|
|
21
27
|
export type V2ModelIds = (typeof V2ModelIds)[keyof typeof V2ModelIds];
|
|
@@ -6,19 +6,25 @@ exports.V2ModelIds = void 0;
|
|
|
6
6
|
* Model IDs accepted by `POST /v2/chat/completions` (case-sensitive; unknown ids return `404`):
|
|
7
7
|
*
|
|
8
8
|
* - **`sarvam-105b`** — Sarvam flagship chat model.
|
|
9
|
+
* - **`sarvam-105b-conversations`** — Sarvam 105B tuned for real-time dialogue and voice agents; 32,000-token context window.
|
|
9
10
|
* - **`glm5.3`** — 1,048,576-token context window; visible reasoning in `reasoning_content` (billed as completion tokens); tool calling; max request size 10,485,760 bytes; `n` must be `1`.
|
|
10
11
|
* - **`glm5.3-flash`** — 1,048,576-token context window, image input (inline base64), tool calling, and reasoning (on by default).
|
|
11
12
|
* - **`gemma4`** — 262,144-token context window, image input (inline base64), tool calling, and optional reasoning (`reasoning_effort`).
|
|
12
|
-
* - **`deepseekv4.1-flash-1017`** — 1,048,576-token context window, tool calling, and reasoning.
|
|
13
|
+
* - **`deepseekv4.1-flash-1017`** — 1,048,576-token context window, image input (inline base64), tool calling, and reasoning.
|
|
14
|
+
* - **`deepseekv4.1-flash-1017-interactive`** — the same model on a high-throughput deployment: more than 200 output tokens per second, against about 80; same capabilities as `deepseekv4.1-flash-1017`.
|
|
13
15
|
* - **`deepseekv4-pro`** (Provisioned Throughput) — 1,000,000-token context window; text input only; tool calling; reasoning (default `high`; `none` turns it off).
|
|
14
|
-
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — 1,048,576-token context window; image
|
|
16
|
+
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — 1,048,576-token context window; image and video input (inline base64); tool calling; reasoning is always on (default `max`).
|
|
17
|
+
* - **`qwen38-27b`** (Provisioned Throughput) — 262,144-token context window; image input (inline base64); tool calling; reasoning on by default (`none` turns it off).
|
|
15
18
|
*/
|
|
16
19
|
exports.V2ModelIds = {
|
|
17
20
|
Sarvam105B: "sarvam-105b",
|
|
21
|
+
Sarvam105BConversations: "sarvam-105b-conversations",
|
|
18
22
|
Glm53: "glm5.3",
|
|
19
23
|
Glm53Flash: "glm5.3-flash",
|
|
20
24
|
Gemma4: "gemma4",
|
|
21
25
|
Deepseekv41Flash1017: "deepseekv4.1-flash-1017",
|
|
26
|
+
Deepseekv41Flash1017Interactive: "deepseekv4.1-flash-1017-interactive",
|
|
22
27
|
Deepseekv4Pro: "deepseekv4-pro",
|
|
23
28
|
KimiK31Pro: "kimi-k3.1-pro",
|
|
29
|
+
Qwen3827B: "qwen38-27b",
|
|
24
30
|
};
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.17";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "sarvamai",
|
|
9
|
-
"X-Fern-SDK-Version": "1.1.
|
|
10
|
-
"User-Agent": "sarvamai/1.1.
|
|
9
|
+
"X-Fern-SDK-Version": "1.1.17",
|
|
10
|
+
"User-Agent": "sarvamai/1.1.17",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -305,8 +305,12 @@ export class ChatClient {
|
|
|
305
305
|
throw new SarvamAI.BadRequestError(body, rawResponse);
|
|
306
306
|
case 401:
|
|
307
307
|
throw new SarvamAI.UnauthorizedError(body, rawResponse);
|
|
308
|
+
case 402:
|
|
309
|
+
throw new SarvamAI.PaymentRequiredError(body, rawResponse);
|
|
308
310
|
case 403:
|
|
309
311
|
throw new SarvamAI.ForbiddenError(body, rawResponse);
|
|
312
|
+
case 404:
|
|
313
|
+
throw new SarvamAI.NotFoundError(body, rawResponse);
|
|
310
314
|
case 413:
|
|
311
315
|
throw new SarvamAI.ContentTooLargeError(body, rawResponse);
|
|
312
316
|
case 422:
|
|
@@ -315,8 +319,12 @@ export class ChatClient {
|
|
|
315
319
|
throw new SarvamAI.TooManyRequestsError(body, rawResponse);
|
|
316
320
|
case 500:
|
|
317
321
|
throw new SarvamAI.InternalServerError(body, rawResponse);
|
|
322
|
+
case 502:
|
|
323
|
+
throw new SarvamAI.BadGatewayError(body, rawResponse);
|
|
318
324
|
case 503:
|
|
319
325
|
throw new SarvamAI.ServiceUnavailableError(body, rawResponse);
|
|
326
|
+
case 504:
|
|
327
|
+
throw new SarvamAI.GatewayTimeoutError(body, rawResponse);
|
|
320
328
|
default:
|
|
321
329
|
throw new errors.SarvamAIError({
|
|
322
330
|
statusCode,
|
|
@@ -20,7 +20,7 @@ export interface CreateChatCompletionV2Request {
|
|
|
20
20
|
temperature?: number;
|
|
21
21
|
/** Nucleus sampling: greater than `0` and at most `1`. On `glm5.3`, `top_p: 0` is rejected. Prefer changing either `top_p` or `temperature`, not both. */
|
|
22
22
|
top_p?: number;
|
|
23
|
-
/** On reasoning models
|
|
23
|
+
/** On reasoning models: **`low`**, **`high`**, or **`max`** on every reasoning model, and **`medium`** on `sarvam-105b`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `kimi-k3.1-pro`, and `qwen38-27b` (`kimi-k3.1-pro` runs `medium` as `high`). Default when omitted is **`max`** on `glm5.3` and `kimi-k3.1-pro`, **`high`** on `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, and no reasoning on `gemma4`; `qwen38-27b` thinks by default. **`none`** turns thinking off on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`. `kimi-k3.1-pro` always thinks: `none`, `minimal`, and `xhigh` return `400`. Trace in `message.reasoning_content`; billed as completion tokens and counts toward `max_tokens`. On `gemma4`, reasoning is off unless this is set (`low`, `high`, or `max`). */
|
|
24
24
|
reasoning_effort?: SarvamAI.ReasoningEffort;
|
|
25
25
|
/** Maximum tokens to generate in the completion, including reasoning tokens on reasoning models. Default `2048`. Set explicitly when you need longer answers — a low limit can yield `finish_reason: "length"` with little or no visible `content` if reasoning consumes the budget. */
|
|
26
26
|
max_tokens?: number;
|
|
@@ -59,8 +59,8 @@ export interface CreateChatCompletionV2Request {
|
|
|
59
59
|
parallel_tool_calls?: boolean;
|
|
60
60
|
/** Only valid with `stream: true` (otherwise `400`). Must be a top-level field, not inside `extra_body`. Use `{"include_usage": true}` to receive token usage in the final SSE chunk. */
|
|
61
61
|
stream_options?: SarvamAI.ChatStreamOptions;
|
|
62
|
-
/** If `true`, return log probabilities for output tokens (use with `top_logprobs`). Supported on **`sarvam-105b`**, **`gemma4`**, **`glm5.3-flash`**, **`deepseekv4.1-flash-1017`**, **`deepseekv4-pro`**, and **`
|
|
62
|
+
/** If `true`, return log probabilities for output tokens (use with `top_logprobs`). Supported on **`sarvam-105b`**, **`gemma4`**, **`glm5.3-flash`**, **`deepseekv4.1-flash-1017`**, **`deepseekv4.1-flash-1017-interactive`**, **`deepseekv4-pro`**, and **`qwen38-27b`**. Not supported on **`glm5.3`** or **`kimi-k3.1-pro`** (`400` if enabled). */
|
|
63
63
|
logprobs?: boolean;
|
|
64
|
-
/** How many top token log probabilities to return at each position. Takes effect only when `logprobs` is `true`; without it, some models ignore the field and others return **`400`**. Same model support as `logprobs`: works on `sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4-pro`, and `
|
|
64
|
+
/** How many top token log probabilities to return at each position. Takes effect only when `logprobs` is `true`; without it, some models ignore the field and others return **`400`**. Same model support as `logprobs`: works on `sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; on `glm5.3` and `kimi-k3.1-pro`, omit entirely — do not send `0`, since many SDKs add it by default. */
|
|
65
65
|
top_logprobs?: number;
|
|
66
66
|
}
|
|
@@ -11,17 +11,25 @@ export declare class DecisionsClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<DecisionsClient.Options>;
|
|
12
12
|
constructor(options?: DecisionsClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
14
|
+
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
15
|
+
*
|
|
16
|
+
* **Models:** `sarvam-prism` (serverless) and `clef` (Provisioned Throughput; also reads images).
|
|
15
17
|
*
|
|
16
18
|
* Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
|
|
17
19
|
*
|
|
18
20
|
* **Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
|
|
19
21
|
*
|
|
20
|
-
* **Repeatability:** probabilities can vary slightly between identical requests
|
|
22
|
+
* **Repeatability:** on `sarvam-prism`, probabilities can vary slightly between identical requests and the top answer is stable; the order of `choice` options does not affect the answer. On `clef`, identical requests return identical probabilities.
|
|
23
|
+
*
|
|
24
|
+
* **Images:** `clef` reads base64 images in `images`; image URLs return `400`. `sarvam-prism` refuses `images` (image URLs return `400`, inline images `422`).
|
|
25
|
+
*
|
|
26
|
+
* **Not supported:** streaming. `temperature` returns `422` on both models. `sarvam-prism` also refuses `max_tokens` and `stream` with `422`; `clef` accepts and ignores them. Unknown keys inside a question return `422`.
|
|
21
27
|
*
|
|
22
|
-
* **
|
|
28
|
+
* **Limits:**
|
|
29
|
+
* - `sarvam-prism`: 32,768 tokens per question (state + question + options), 2–255 options per `choice`, and 2–10 levels per `score`. If any one question breaks a limit, the whole request fails with `422`.
|
|
30
|
+
* - `clef`: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per `choice`, and 1–10 levels per `score`. A longer request fails with `400`.
|
|
23
31
|
*
|
|
24
|
-
*
|
|
32
|
+
* There is no cap on the number of questions, and the state is never truncated.
|
|
25
33
|
*
|
|
26
34
|
* **Timeout:** each request must finish within 60 seconds. A longer request fails with `503 model_overloaded`; split very large batches across several requests before retrying.
|
|
27
35
|
*
|
|
@@ -20,17 +20,25 @@ export class DecisionsClient {
|
|
|
20
20
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
23
|
+
* Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
24
|
+
*
|
|
25
|
+
* **Models:** `sarvam-prism` (serverless) and `clef` (Provisioned Throughput; also reads images).
|
|
24
26
|
*
|
|
25
27
|
* Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
|
|
26
28
|
*
|
|
27
29
|
* **Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
|
|
28
30
|
*
|
|
29
|
-
* **Repeatability:** probabilities can vary slightly between identical requests
|
|
31
|
+
* **Repeatability:** on `sarvam-prism`, probabilities can vary slightly between identical requests and the top answer is stable; the order of `choice` options does not affect the answer. On `clef`, identical requests return identical probabilities.
|
|
32
|
+
*
|
|
33
|
+
* **Images:** `clef` reads base64 images in `images`; image URLs return `400`. `sarvam-prism` refuses `images` (image URLs return `400`, inline images `422`).
|
|
34
|
+
*
|
|
35
|
+
* **Not supported:** streaming. `temperature` returns `422` on both models. `sarvam-prism` also refuses `max_tokens` and `stream` with `422`; `clef` accepts and ignores them. Unknown keys inside a question return `422`.
|
|
30
36
|
*
|
|
31
|
-
* **
|
|
37
|
+
* **Limits:**
|
|
38
|
+
* - `sarvam-prism`: 32,768 tokens per question (state + question + options), 2–255 options per `choice`, and 2–10 levels per `score`. If any one question breaks a limit, the whole request fails with `422`.
|
|
39
|
+
* - `clef`: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per `choice`, and 1–10 levels per `score`. A longer request fails with `400`.
|
|
32
40
|
*
|
|
33
|
-
*
|
|
41
|
+
* There is no cap on the number of questions, and the state is never truncated.
|
|
34
42
|
*
|
|
35
43
|
* **Timeout:** each request must finish within 60 seconds. A longer request fails with `503 model_overloaded`; split very large batches across several requests before retrying.
|
|
36
44
|
*
|
|
@@ -139,6 +139,8 @@ export class ResponsesClient {
|
|
|
139
139
|
throw new SarvamAI.BadRequestError(body, rawResponse);
|
|
140
140
|
case 401:
|
|
141
141
|
throw new SarvamAI.UnauthorizedError(body, rawResponse);
|
|
142
|
+
case 402:
|
|
143
|
+
throw new SarvamAI.PaymentRequiredError(body, rawResponse);
|
|
142
144
|
case 403:
|
|
143
145
|
throw new SarvamAI.ForbiddenError(body, rawResponse);
|
|
144
146
|
case 404:
|
|
@@ -185,6 +187,8 @@ export class ResponsesClient {
|
|
|
185
187
|
throw new SarvamAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
186
188
|
case 401:
|
|
187
189
|
throw new SarvamAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
190
|
+
case 402:
|
|
191
|
+
throw new SarvamAI.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
188
192
|
case 403:
|
|
189
193
|
throw new SarvamAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
190
194
|
case 404:
|
|
@@ -19,7 +19,7 @@ export interface ResponsesCreateRequest {
|
|
|
19
19
|
tools?: SarvamAI.ResponseFunctionTool[];
|
|
20
20
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
21
21
|
tool_choice?: ResponsesCreateRequest.ToolChoice;
|
|
22
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
22
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
23
23
|
reasoning?: SarvamAI.ResponseReasoning;
|
|
24
24
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
25
25
|
extra_body?: Record<string, unknown>;
|
|
@@ -48,6 +48,10 @@ export interface ResponsesCreateRequest {
|
|
|
48
48
|
background?: boolean;
|
|
49
49
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
50
50
|
max_tool_calls?: number;
|
|
51
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
52
|
+
top_logprobs?: number;
|
|
53
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
54
|
+
include?: string[];
|
|
51
55
|
/** Accepts any additional properties */
|
|
52
56
|
[key: string]: any;
|
|
53
57
|
}
|
|
@@ -19,7 +19,7 @@ export interface ResponsesCreateStreamRequest {
|
|
|
19
19
|
tools?: SarvamAI.ResponseFunctionTool[];
|
|
20
20
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
21
21
|
tool_choice?: ResponsesCreateStreamRequest.ToolChoice;
|
|
22
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
22
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
23
23
|
reasoning?: SarvamAI.ResponseReasoning;
|
|
24
24
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
25
25
|
extra_body?: Record<string, unknown>;
|
|
@@ -48,6 +48,10 @@ export interface ResponsesCreateStreamRequest {
|
|
|
48
48
|
background?: boolean;
|
|
49
49
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
50
50
|
max_tool_calls?: number;
|
|
51
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
52
|
+
top_logprobs?: number;
|
|
53
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
54
|
+
include?: string[];
|
|
51
55
|
/** Accepts any additional properties */
|
|
52
56
|
[key: string]: any;
|
|
53
57
|
}
|
|
@@ -9,7 +9,7 @@ export interface Choice {
|
|
|
9
9
|
finish_reason: SarvamAI.FinishReason;
|
|
10
10
|
/** The index of the choice in the list of choices. */
|
|
11
11
|
index: number;
|
|
12
|
-
/** Token log probabilities when supported (`sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4-
|
|
12
|
+
/** Token log probabilities when supported (`sarvam-105b`, `gemma4`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `qwen38-27b`). Not supported on `glm5.3` or `kimi-k3.1-pro`, which return `400` when `logprobs` is set. */
|
|
13
13
|
logprobs?: Record<string, unknown> | undefined;
|
|
14
14
|
message: SarvamAI.ChatCompletionResponseMessage;
|
|
15
15
|
}
|
|
@@ -14,7 +14,7 @@ export interface CreateResponseV2Request {
|
|
|
14
14
|
tools?: SarvamAI.ResponseFunctionTool[] | undefined;
|
|
15
15
|
/** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
|
|
16
16
|
tool_choice?: CreateResponseV2Request.ToolChoice | undefined;
|
|
17
|
-
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`,
|
|
17
|
+
/** Optional reasoning config for `glm5.3`, `glm5.3-flash`, `gemma4`, the DeepSeek models, `kimi-k3.1-pro`, and `qwen38-27b`. **`effort`:** on `glm5.3` and `glm5.3-flash`, `low` or `high` only (the literal string `max` returns `400`; omitting it gives `max` on `glm5.3` and `high` on `glm5.3-flash`); on `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro`, `low`, `high`, `max`, or `none` (thinking off); on `kimi-k3.1-pro`, `low`, `medium`, `high`, or `max` (thinking is always on); on `qwen38-27b`, `none` turns thinking off. The trace is in the reasoning item's `content[0].text`; `summary` is filled only when `summary` is set. Optional **`summary`:** `auto` or `detailed`. */
|
|
18
18
|
reasoning?: SarvamAI.ResponseReasoning | undefined;
|
|
19
19
|
/** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
|
|
20
20
|
extra_body?: Record<string, unknown> | undefined;
|
|
@@ -43,6 +43,10 @@ export interface CreateResponseV2Request {
|
|
|
43
43
|
background?: boolean | undefined;
|
|
44
44
|
/** `400 invalid_request_error` — not supported by any serving deployment, top-level or via `extra_body`. */
|
|
45
45
|
max_tool_calls?: number | undefined;
|
|
46
|
+
/** How many of the most likely tokens to return at each output position, with their log probabilities. Send it with `include: ["message.output_text.logprobs"]`; without `include`, `output[].content[].logprobs` comes back empty. `0` returns no logprobs. Supported on `sarvam-105b`, `glm5.3-flash`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, and `qwen38-27b`; `glm5.3`, `gemma4`, and `kimi-k3.1-pro` return `400`. */
|
|
47
|
+
top_logprobs?: number | undefined;
|
|
48
|
+
/** Extra data to add to the response. `message.output_text.logprobs` returns token log probabilities (use with `top_logprobs`); `reasoning.encrypted_content` is accepted. An unknown value returns `400`. */
|
|
49
|
+
include?: string[] | undefined;
|
|
46
50
|
/** Accepts any additional properties */
|
|
47
51
|
[key: string]: any;
|
|
48
52
|
}
|
|
@@ -3,4 +3,14 @@ export interface ModelObject {
|
|
|
3
3
|
object?: "model" | undefined;
|
|
4
4
|
created: number;
|
|
5
5
|
owned_by: string;
|
|
6
|
+
/** How the model is offered. `"provisioned"`: Provisioned Throughput, enabled per organisation (without access, `deepseekv4-pro` returns `400` and the others return `404` and aren't listed). `"standard"`: serverless, any API key can call it. */
|
|
7
|
+
access?: ModelObject.Access | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace ModelObject {
|
|
10
|
+
/** How the model is offered. `"provisioned"`: Provisioned Throughput, enabled per organisation (without access, `deepseekv4-pro` returns `400` and the others return `404` and aren't listed). `"standard"`: serverless, any API key can call it. */
|
|
11
|
+
const Access: {
|
|
12
|
+
readonly Standard: "standard";
|
|
13
|
+
readonly Provisioned: "provisioned";
|
|
14
|
+
};
|
|
15
|
+
type Access = (typeof Access)[keyof typeof Access];
|
|
6
16
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
export
|
|
2
|
+
export var ModelObject;
|
|
3
|
+
(function (ModelObject) {
|
|
4
|
+
/** How the model is offered. `"provisioned"`: Provisioned Throughput, enabled per organisation (without access, `deepseekv4-pro` returns `400` and the others return `404` and aren't listed). `"standard"`: serverless, any API key can call it. */
|
|
5
|
+
ModelObject.Access = {
|
|
6
|
+
Standard: "standard",
|
|
7
|
+
Provisioned: "provisioned",
|
|
8
|
+
};
|
|
9
|
+
})(ModelObject || (ModelObject = {}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/** Reasoning depth on `
|
|
1
|
+
/** Reasoning depth. `low`, `high`, and `max` work on every reasoning model; `medium` also works on `sarvam-105b`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `kimi-k3.1-pro`, and `qwen38-27b`. Default when omitted is `max` on `glm5.3` and `kimi-k3.1-pro`, `high` on `glm5.3-flash` and the DeepSeek models, and no reasoning on `gemma4`. `none` turns thinking off on the DeepSeek models and `qwen38-27b`; `kimi-k3.1-pro` refuses it, and other models reject it or keep thinking. */
|
|
2
2
|
export declare const ReasoningEffort: {
|
|
3
3
|
readonly None: "none";
|
|
4
4
|
readonly Low: "low";
|
|
5
|
+
readonly Medium: "medium";
|
|
5
6
|
readonly High: "high";
|
|
6
7
|
readonly Max: "max";
|
|
7
8
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
/** Reasoning depth on `
|
|
2
|
+
/** Reasoning depth. `low`, `high`, and `max` work on every reasoning model; `medium` also works on `sarvam-105b`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `kimi-k3.1-pro`, and `qwen38-27b`. Default when omitted is `max` on `glm5.3` and `kimi-k3.1-pro`, `high` on `glm5.3-flash` and the DeepSeek models, and no reasoning on `gemma4`. `none` turns thinking off on the DeepSeek models and `qwen38-27b`; `kimi-k3.1-pro` refuses it, and other models reject it or keep thinking. */
|
|
3
3
|
export const ReasoningEffort = {
|
|
4
4
|
None: "none",
|
|
5
5
|
Low: "low",
|
|
6
|
+
Medium: "medium",
|
|
6
7
|
High: "high",
|
|
7
8
|
Max: "max",
|
|
8
9
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as SarvamAI from "../index.mjs";
|
|
2
2
|
export interface ResponseReasoning {
|
|
3
|
-
/** `low`, `high`, or `max
|
|
3
|
+
/** `low`, `high`, or `max`, plus `medium` and `none` on some models. On **`glm5.3`** and **`glm5.3-flash`**, sending the literal string `max` returns `400`; omitting the field gives `max` on `glm5.3` and `high` on `glm5.3-flash`. **`deepseekv4.1-flash-1017`**, **`deepseekv4.1-flash-1017-interactive`**, and **`deepseekv4-pro`** accept `max` directly, and `none` turns thinking off. **`kimi-k3.1-pro`** accepts `low`, `medium`, `high`, or `max` and always thinks. **`qwen38-27b`** thinks by default; `none` turns it off. `gemma4` accepts `low` or `high`; omitting it means no reasoning. */
|
|
4
4
|
effort?: SarvamAI.ResponseReasoningEffort | undefined;
|
|
5
5
|
/** `auto` or `detailed`. Without it, the reasoning item's `summary` is empty; read the trace from `content[0].text`. */
|
|
6
6
|
summary?: ResponseReasoning.Summary | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/** Reasoning effort on the Responses route. `deepseekv4.1-flash-1017`, `deepseekv4-pro`, and `kimi-k3.1-pro`
|
|
1
|
+
/** Reasoning effort on the Responses route. `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro` accept `low`, `high`, and `max` directly, and `none` turns thinking off. `kimi-k3.1-pro` accepts `low`, `medium`, `high`, and `max` and always thinks. `qwen38-27b` thinks by default; `none` turns it off. `glm5.3` and `glm5.3-flash` accept `low` and `high`; the literal string `max` returns `400` on them. Omitting the field gives `max` on `glm5.3` and `high` on `glm5.3-flash`. `gemma4` accepts `low` or `high`; omitting the field means no reasoning. */
|
|
2
2
|
export declare const ResponseReasoningEffort: {
|
|
3
3
|
readonly None: "none";
|
|
4
4
|
readonly Low: "low";
|
|
5
|
+
readonly Medium: "medium";
|
|
5
6
|
readonly High: "high";
|
|
6
7
|
readonly Max: "max";
|
|
7
8
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
/** Reasoning effort on the Responses route. `deepseekv4.1-flash-1017`, `deepseekv4-pro`, and `kimi-k3.1-pro`
|
|
2
|
+
/** Reasoning effort on the Responses route. `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, and `deepseekv4-pro` accept `low`, `high`, and `max` directly, and `none` turns thinking off. `kimi-k3.1-pro` accepts `low`, `medium`, `high`, and `max` and always thinks. `qwen38-27b` thinks by default; `none` turns it off. `glm5.3` and `glm5.3-flash` accept `low` and `high`; the literal string `max` returns `400` on them. Omitting the field gives `max` on `glm5.3` and `high` on `glm5.3-flash`. `gemma4` accepts `low` or `high`; omitting the field means no reasoning. */
|
|
3
3
|
export const ResponseReasoningEffort = {
|
|
4
4
|
None: "none",
|
|
5
5
|
Low: "low",
|
|
6
|
+
Medium: "medium",
|
|
6
7
|
High: "high",
|
|
7
8
|
Max: "max",
|
|
8
9
|
};
|
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
* Model IDs accepted by `POST /v2/responses` (case-sensitive; unknown ids return `404`):
|
|
3
3
|
*
|
|
4
4
|
* - **`sarvam-105b`** — Sarvam flagship model.
|
|
5
|
+
* - **`sarvam-105b-conversations`** — Sarvam 105B tuned for real-time dialogue.
|
|
5
6
|
* - **`glm5.3`** — 1,048,576-token context; reasoning in `output` as a `reasoning` item; flat function tools; max request size 10,485,760 bytes.
|
|
6
7
|
* - **`glm5.3-flash`** — long context, vision (inline base64 images), tools, and reasoning; `reasoning.effort` accepts `low` or `high` only, as on `glm5.3`.
|
|
7
8
|
* - **`gemma4`** — 262,144-token context, vision (inline base64 images), tools, and optional reasoning (`reasoning.effort` `low` or `high`).
|
|
8
|
-
* - **`deepseekv4.1-flash-1017`** — long context, tools, and reasoning.
|
|
9
|
+
* - **`deepseekv4.1-flash-1017`** — long context, vision (inline base64 images), tools, and reasoning.
|
|
10
|
+
* - **`deepseekv4.1-flash-1017-interactive`** — same capabilities as `deepseekv4.1-flash-1017`, on a high-throughput deployment (more than 200 output tokens per second).
|
|
9
11
|
* - **`deepseekv4-pro`** (Provisioned Throughput) — long context, text input, tools, and reasoning (default `high`).
|
|
10
12
|
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — long context, image input (inline base64; no video on this route), tools, and reasoning (always on).
|
|
13
|
+
* - **`qwen38-27b`** (Provisioned Throughput) — 262,144-token context, image input (inline base64), tools, and reasoning (on by default).
|
|
11
14
|
*/
|
|
12
15
|
export declare const ResponsesModelIds: {
|
|
13
16
|
readonly Sarvam105B: "sarvam-105b";
|
|
17
|
+
readonly Sarvam105BConversations: "sarvam-105b-conversations";
|
|
14
18
|
readonly Glm53: "glm5.3";
|
|
15
19
|
readonly Glm53Flash: "glm5.3-flash";
|
|
16
20
|
readonly Gemma4: "gemma4";
|
|
17
21
|
readonly Deepseekv41Flash1017: "deepseekv4.1-flash-1017";
|
|
22
|
+
readonly Deepseekv41Flash1017Interactive: "deepseekv4.1-flash-1017-interactive";
|
|
18
23
|
readonly Deepseekv4Pro: "deepseekv4-pro";
|
|
19
24
|
readonly KimiK31Pro: "kimi-k3.1-pro";
|
|
25
|
+
readonly Qwen3827B: "qwen38-27b";
|
|
20
26
|
};
|
|
21
27
|
export type ResponsesModelIds = (typeof ResponsesModelIds)[keyof typeof ResponsesModelIds];
|
|
@@ -3,19 +3,25 @@
|
|
|
3
3
|
* Model IDs accepted by `POST /v2/responses` (case-sensitive; unknown ids return `404`):
|
|
4
4
|
*
|
|
5
5
|
* - **`sarvam-105b`** — Sarvam flagship model.
|
|
6
|
+
* - **`sarvam-105b-conversations`** — Sarvam 105B tuned for real-time dialogue.
|
|
6
7
|
* - **`glm5.3`** — 1,048,576-token context; reasoning in `output` as a `reasoning` item; flat function tools; max request size 10,485,760 bytes.
|
|
7
8
|
* - **`glm5.3-flash`** — long context, vision (inline base64 images), tools, and reasoning; `reasoning.effort` accepts `low` or `high` only, as on `glm5.3`.
|
|
8
9
|
* - **`gemma4`** — 262,144-token context, vision (inline base64 images), tools, and optional reasoning (`reasoning.effort` `low` or `high`).
|
|
9
|
-
* - **`deepseekv4.1-flash-1017`** — long context, tools, and reasoning.
|
|
10
|
+
* - **`deepseekv4.1-flash-1017`** — long context, vision (inline base64 images), tools, and reasoning.
|
|
11
|
+
* - **`deepseekv4.1-flash-1017-interactive`** — same capabilities as `deepseekv4.1-flash-1017`, on a high-throughput deployment (more than 200 output tokens per second).
|
|
10
12
|
* - **`deepseekv4-pro`** (Provisioned Throughput) — long context, text input, tools, and reasoning (default `high`).
|
|
11
13
|
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — long context, image input (inline base64; no video on this route), tools, and reasoning (always on).
|
|
14
|
+
* - **`qwen38-27b`** (Provisioned Throughput) — 262,144-token context, image input (inline base64), tools, and reasoning (on by default).
|
|
12
15
|
*/
|
|
13
16
|
export const ResponsesModelIds = {
|
|
14
17
|
Sarvam105B: "sarvam-105b",
|
|
18
|
+
Sarvam105BConversations: "sarvam-105b-conversations",
|
|
15
19
|
Glm53: "glm5.3",
|
|
16
20
|
Glm53Flash: "glm5.3-flash",
|
|
17
21
|
Gemma4: "gemma4",
|
|
18
22
|
Deepseekv41Flash1017: "deepseekv4.1-flash-1017",
|
|
23
|
+
Deepseekv41Flash1017Interactive: "deepseekv4.1-flash-1017-interactive",
|
|
19
24
|
Deepseekv4Pro: "deepseekv4-pro",
|
|
20
25
|
KimiK31Pro: "kimi-k3.1-pro",
|
|
26
|
+
Qwen3827B: "qwen38-27b",
|
|
21
27
|
};
|
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
* Model IDs accepted by `POST /v2/chat/completions` (case-sensitive; unknown ids return `404`):
|
|
3
3
|
*
|
|
4
4
|
* - **`sarvam-105b`** — Sarvam flagship chat model.
|
|
5
|
+
* - **`sarvam-105b-conversations`** — Sarvam 105B tuned for real-time dialogue and voice agents; 32,000-token context window.
|
|
5
6
|
* - **`glm5.3`** — 1,048,576-token context window; visible reasoning in `reasoning_content` (billed as completion tokens); tool calling; max request size 10,485,760 bytes; `n` must be `1`.
|
|
6
7
|
* - **`glm5.3-flash`** — 1,048,576-token context window, image input (inline base64), tool calling, and reasoning (on by default).
|
|
7
8
|
* - **`gemma4`** — 262,144-token context window, image input (inline base64), tool calling, and optional reasoning (`reasoning_effort`).
|
|
8
|
-
* - **`deepseekv4.1-flash-1017`** — 1,048,576-token context window, tool calling, and reasoning.
|
|
9
|
+
* - **`deepseekv4.1-flash-1017`** — 1,048,576-token context window, image input (inline base64), tool calling, and reasoning.
|
|
10
|
+
* - **`deepseekv4.1-flash-1017-interactive`** — the same model on a high-throughput deployment: more than 200 output tokens per second, against about 80; same capabilities as `deepseekv4.1-flash-1017`.
|
|
9
11
|
* - **`deepseekv4-pro`** (Provisioned Throughput) — 1,000,000-token context window; text input only; tool calling; reasoning (default `high`; `none` turns it off).
|
|
10
|
-
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — 1,048,576-token context window; image
|
|
12
|
+
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — 1,048,576-token context window; image and video input (inline base64); tool calling; reasoning is always on (default `max`).
|
|
13
|
+
* - **`qwen38-27b`** (Provisioned Throughput) — 262,144-token context window; image input (inline base64); tool calling; reasoning on by default (`none` turns it off).
|
|
11
14
|
*/
|
|
12
15
|
export declare const V2ModelIds: {
|
|
13
16
|
readonly Sarvam105B: "sarvam-105b";
|
|
17
|
+
readonly Sarvam105BConversations: "sarvam-105b-conversations";
|
|
14
18
|
readonly Glm53: "glm5.3";
|
|
15
19
|
readonly Glm53Flash: "glm5.3-flash";
|
|
16
20
|
readonly Gemma4: "gemma4";
|
|
17
21
|
readonly Deepseekv41Flash1017: "deepseekv4.1-flash-1017";
|
|
22
|
+
readonly Deepseekv41Flash1017Interactive: "deepseekv4.1-flash-1017-interactive";
|
|
18
23
|
readonly Deepseekv4Pro: "deepseekv4-pro";
|
|
19
24
|
readonly KimiK31Pro: "kimi-k3.1-pro";
|
|
25
|
+
readonly Qwen3827B: "qwen38-27b";
|
|
20
26
|
};
|
|
21
27
|
export type V2ModelIds = (typeof V2ModelIds)[keyof typeof V2ModelIds];
|
|
@@ -3,19 +3,25 @@
|
|
|
3
3
|
* Model IDs accepted by `POST /v2/chat/completions` (case-sensitive; unknown ids return `404`):
|
|
4
4
|
*
|
|
5
5
|
* - **`sarvam-105b`** — Sarvam flagship chat model.
|
|
6
|
+
* - **`sarvam-105b-conversations`** — Sarvam 105B tuned for real-time dialogue and voice agents; 32,000-token context window.
|
|
6
7
|
* - **`glm5.3`** — 1,048,576-token context window; visible reasoning in `reasoning_content` (billed as completion tokens); tool calling; max request size 10,485,760 bytes; `n` must be `1`.
|
|
7
8
|
* - **`glm5.3-flash`** — 1,048,576-token context window, image input (inline base64), tool calling, and reasoning (on by default).
|
|
8
9
|
* - **`gemma4`** — 262,144-token context window, image input (inline base64), tool calling, and optional reasoning (`reasoning_effort`).
|
|
9
|
-
* - **`deepseekv4.1-flash-1017`** — 1,048,576-token context window, tool calling, and reasoning.
|
|
10
|
+
* - **`deepseekv4.1-flash-1017`** — 1,048,576-token context window, image input (inline base64), tool calling, and reasoning.
|
|
11
|
+
* - **`deepseekv4.1-flash-1017-interactive`** — the same model on a high-throughput deployment: more than 200 output tokens per second, against about 80; same capabilities as `deepseekv4.1-flash-1017`.
|
|
10
12
|
* - **`deepseekv4-pro`** (Provisioned Throughput) — 1,000,000-token context window; text input only; tool calling; reasoning (default `high`; `none` turns it off).
|
|
11
|
-
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — 1,048,576-token context window; image
|
|
13
|
+
* - **`kimi-k3.1-pro`** (Provisioned Throughput) — 1,048,576-token context window; image and video input (inline base64); tool calling; reasoning is always on (default `max`).
|
|
14
|
+
* - **`qwen38-27b`** (Provisioned Throughput) — 262,144-token context window; image input (inline base64); tool calling; reasoning on by default (`none` turns it off).
|
|
12
15
|
*/
|
|
13
16
|
export const V2ModelIds = {
|
|
14
17
|
Sarvam105B: "sarvam-105b",
|
|
18
|
+
Sarvam105BConversations: "sarvam-105b-conversations",
|
|
15
19
|
Glm53: "glm5.3",
|
|
16
20
|
Glm53Flash: "glm5.3-flash",
|
|
17
21
|
Gemma4: "gemma4",
|
|
18
22
|
Deepseekv41Flash1017: "deepseekv4.1-flash-1017",
|
|
23
|
+
Deepseekv41Flash1017Interactive: "deepseekv4.1-flash-1017-interactive",
|
|
19
24
|
Deepseekv4Pro: "deepseekv4-pro",
|
|
20
25
|
KimiK31Pro: "kimi-k3.1-pro",
|
|
26
|
+
Qwen3827B: "qwen38-27b",
|
|
21
27
|
};
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.17";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.1.
|
|
1
|
+
export const SDK_VERSION = "1.1.17";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -3874,7 +3874,7 @@ await client.docAi.getCapabilities();
|
|
|
3874
3874
|
|
|
3875
3875
|
Generate a model reply in the OpenAI Responses format.
|
|
3876
3876
|
|
|
3877
|
-
**Models:** `sarvam-105b`, `glm5.3`, `gemma4`, `deepseekv4.1-flash-1017`, `glm5.3-flash`, `deepseekv4-pro`, `kimi-k3.1-pro` (ids are case-sensitive).
|
|
3877
|
+
**Models:** `sarvam-105b`, `sarvam-105b-conversations`, `glm5.3`, `gemma4`, `deepseekv4.1-flash-1017`, `glm5.3-flash`, `deepseekv4.1-flash-1017-interactive`, and, on Provisioned Throughput, `deepseekv4-pro`, `kimi-k3.1-pro`, `qwen38-27b` (ids are case-sensitive).
|
|
3878
3878
|
|
|
3879
3879
|
**Each call is independent.** Send the full conversation in `input` every time — nothing is stored for you. Leave out `store` or set it to `false` (`true` returns **`400`**). You cannot load a past response by id (`GET /v2/responses/{id}` is always **`404`**).
|
|
3880
3880
|
|
|
@@ -3953,7 +3953,7 @@ for await (const item of response) {
|
|
|
3953
3953
|
|
|
3954
3954
|
Generate a model reply in the OpenAI Responses format.
|
|
3955
3955
|
|
|
3956
|
-
**Models:** `sarvam-105b`, `glm5.3`, `gemma4`, `deepseekv4.1-flash-1017`, `glm5.3-flash`, `deepseekv4-pro`, `kimi-k3.1-pro` (ids are case-sensitive).
|
|
3956
|
+
**Models:** `sarvam-105b`, `sarvam-105b-conversations`, `glm5.3`, `gemma4`, `deepseekv4.1-flash-1017`, `glm5.3-flash`, `deepseekv4.1-flash-1017-interactive`, and, on Provisioned Throughput, `deepseekv4-pro`, `kimi-k3.1-pro`, `qwen38-27b` (ids are case-sensitive).
|
|
3957
3957
|
|
|
3958
3958
|
**Each call is independent.** Send the full conversation in `input` every time — nothing is stored for you. Leave out `store` or set it to `false` (`true` returns **`400`**). You cannot load a past response by id (`GET /v2/responses/{id}` is always **`404`**).
|
|
3959
3959
|
|
|
@@ -4147,17 +4147,25 @@ await client.chatCompletion.getModelV2("model_id");
|
|
|
4147
4147
|
<dl>
|
|
4148
4148
|
<dd>
|
|
4149
4149
|
|
|
4150
|
-
Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
4150
|
+
Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.
|
|
4151
|
+
|
|
4152
|
+
**Models:** `sarvam-prism` (serverless) and `clef` (Provisioned Throughput; also reads images).
|
|
4151
4153
|
|
|
4152
4154
|
Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
|
|
4153
4155
|
|
|
4154
4156
|
**Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
|
|
4155
4157
|
|
|
4156
|
-
**Repeatability:** probabilities can vary slightly between identical requests
|
|
4158
|
+
**Repeatability:** on `sarvam-prism`, probabilities can vary slightly between identical requests and the top answer is stable; the order of `choice` options does not affect the answer. On `clef`, identical requests return identical probabilities.
|
|
4159
|
+
|
|
4160
|
+
**Images:** `clef` reads base64 images in `images`; image URLs return `400`. `sarvam-prism` refuses `images` (image URLs return `400`, inline images `422`).
|
|
4161
|
+
|
|
4162
|
+
**Not supported:** streaming. `temperature` returns `422` on both models. `sarvam-prism` also refuses `max_tokens` and `stream` with `422`; `clef` accepts and ignores them. Unknown keys inside a question return `422`.
|
|
4157
4163
|
|
|
4158
|
-
**
|
|
4164
|
+
**Limits:**
|
|
4165
|
+
- `sarvam-prism`: 32,768 tokens per question (state + question + options), 2–255 options per `choice`, and 2–10 levels per `score`. If any one question breaks a limit, the whole request fails with `422`.
|
|
4166
|
+
- `clef`: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per `choice`, and 1–10 levels per `score`. A longer request fails with `400`.
|
|
4159
4167
|
|
|
4160
|
-
|
|
4168
|
+
There is no cap on the number of questions, and the state is never truncated.
|
|
4161
4169
|
|
|
4162
4170
|
**Timeout:** each request must finish within 60 seconds. A longer request fails with `503 model_overloaded`; split very large batches across several requests before retrying.
|
|
4163
4171
|
|