ainvoker 3.1.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@ Official TypeScript/JavaScript SDK for the AInvoker AI gateway.
6
6
 
7
7
  AInvoker is an AI gateway. This package calls one HTTP API and routes to providers such as OpenAI and Gemini. Create projects, API keys, and billing in the [dashboard](https://ainvoker.com). Use the SDK to call models from your application.
8
8
 
9
- Current release: **3.1.0** (`ai.text.chat` and `ai.text.stream` for `POST /v1/text/chat` and `POST /v1/text/stream`).
9
+ Current release: **3.2.0** (`ai.text.chat` and `ai.text.stream` for `POST /v1/text/chat` and `POST /v1/text/stream`, with optional `reasoning`; adds `gemini-3.5-flash-lite`).
10
10
 
11
11
  ## Install
12
12
 
@@ -64,8 +64,9 @@ try {
64
64
  | `messages` | Yes | At least one message. Roles: `system`, `user`, `assistant`. |
65
65
  | `temperature` | No | Sampling temperature from 0 to 2. |
66
66
  | `maxTokens` | No | Maximum tokens to generate. When omitted, the gateway reserves and caps output at 8192. |
67
+ | `reasoning` | No | `minimal`, `low`, `medium`, or `high`. Thinking depth for models that support it (Gemini); lower reaches the first token faster. Ignored by models without thinking, such as `gpt-4o-mini`. Omit for the provider default. |
67
68
 
68
- The result is `{ id, model, message, usage }`. `usage` is `{ inputTokens, outputTokens, totalTokens }` or `null` when the gateway does not report it.
69
+ The result is `{ id, model, message, usage }`. `usage` is `{ inputTokens, outputTokens, totalTokens }` or `null` when the gateway does not report it. For thinking models, `outputTokens` includes thinking tokens.
69
70
 
70
71
  For Gemini models, include at least one `user` or `assistant` message. A system-only prompt is not enough.
71
72
 
package/dist/index.d.cts CHANGED
@@ -26,7 +26,7 @@ interface ChatMessage {
26
26
  */
27
27
  type TextCatalog = {
28
28
  openai: "gpt-4o-mini";
29
- gemini: "gemini-3.6-flash";
29
+ gemini: "gemini-3.6-flash" | "gemini-3.5-flash-lite";
30
30
  };
31
31
  type TextProvider = keyof TextCatalog;
32
32
  type TextModel = TextCatalog[TextProvider];
@@ -37,6 +37,8 @@ type TextCatalogPair = {
37
37
  model: TextCatalog[P];
38
38
  };
39
39
  }[TextProvider];
40
+ /** Thinking depth for models that support it. */
41
+ type TextReasoning = "minimal" | "low" | "medium" | "high";
40
42
  type TextChatFields = {
41
43
  messages: ChatMessage[];
42
44
  /** Sampling temperature (0–2). */
@@ -46,6 +48,12 @@ type TextChatFields = {
46
48
  * When omitted, the gateway reserves and caps output at 8192.
47
49
  */
48
50
  maxTokens?: number;
51
+ /**
52
+ * Thinking depth for models that support it (Gemini). Lower is faster to the
53
+ * first token. Ignored by models without thinking (for example gpt-4o-mini).
54
+ * When omitted, the provider default applies.
55
+ */
56
+ reasoning?: TextReasoning;
49
57
  };
50
58
  /**
51
59
  * Provider omitted: model may be any catalog name (or a future API name).
@@ -191,4 +199,4 @@ declare class AInvokerError extends Error {
191
199
  /** Type guard for {@link AInvokerError}. */
192
200
  declare function isAInvokerError(error: unknown): error is AInvokerError;
193
201
 
194
- export { AInvoker, AInvokerError, type AInvokerErrorCode, type AInvokerOptions, type ChatMessage, type ChatUsage, type TextCatalog, type TextCatalogPair, type TextChatEscapeParams, type TextChatParams, type TextChatResult, type TextModel, type TextProvider, type TextStreamEvent, isAInvokerError };
202
+ export { AInvoker, AInvokerError, type AInvokerErrorCode, type AInvokerOptions, type ChatMessage, type ChatUsage, type TextCatalog, type TextCatalogPair, type TextChatEscapeParams, type TextChatParams, type TextChatResult, type TextModel, type TextProvider, type TextReasoning, type TextStreamEvent, isAInvokerError };
package/dist/index.d.ts CHANGED
@@ -26,7 +26,7 @@ interface ChatMessage {
26
26
  */
27
27
  type TextCatalog = {
28
28
  openai: "gpt-4o-mini";
29
- gemini: "gemini-3.6-flash";
29
+ gemini: "gemini-3.6-flash" | "gemini-3.5-flash-lite";
30
30
  };
31
31
  type TextProvider = keyof TextCatalog;
32
32
  type TextModel = TextCatalog[TextProvider];
@@ -37,6 +37,8 @@ type TextCatalogPair = {
37
37
  model: TextCatalog[P];
38
38
  };
39
39
  }[TextProvider];
40
+ /** Thinking depth for models that support it. */
41
+ type TextReasoning = "minimal" | "low" | "medium" | "high";
40
42
  type TextChatFields = {
41
43
  messages: ChatMessage[];
42
44
  /** Sampling temperature (0–2). */
@@ -46,6 +48,12 @@ type TextChatFields = {
46
48
  * When omitted, the gateway reserves and caps output at 8192.
47
49
  */
48
50
  maxTokens?: number;
51
+ /**
52
+ * Thinking depth for models that support it (Gemini). Lower is faster to the
53
+ * first token. Ignored by models without thinking (for example gpt-4o-mini).
54
+ * When omitted, the provider default applies.
55
+ */
56
+ reasoning?: TextReasoning;
49
57
  };
50
58
  /**
51
59
  * Provider omitted: model may be any catalog name (or a future API name).
@@ -191,4 +199,4 @@ declare class AInvokerError extends Error {
191
199
  /** Type guard for {@link AInvokerError}. */
192
200
  declare function isAInvokerError(error: unknown): error is AInvokerError;
193
201
 
194
- export { AInvoker, AInvokerError, type AInvokerErrorCode, type AInvokerOptions, type ChatMessage, type ChatUsage, type TextCatalog, type TextCatalogPair, type TextChatEscapeParams, type TextChatParams, type TextChatResult, type TextModel, type TextProvider, type TextStreamEvent, isAInvokerError };
202
+ export { AInvoker, AInvokerError, type AInvokerErrorCode, type AInvokerOptions, type ChatMessage, type ChatUsage, type TextCatalog, type TextCatalogPair, type TextChatEscapeParams, type TextChatParams, type TextChatResult, type TextModel, type TextProvider, type TextReasoning, type TextStreamEvent, isAInvokerError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ainvoker",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "description": "Official TypeScript/JavaScript SDK for the AInvoker AI gateway",
5
5
  "license": "MIT",
6
6
  "author": "AInvoker",