@prismshadow/mmsp 0.5.0 → 0.5.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
@@ -27,8 +27,8 @@ async function main() {
27
27
  // const client = new AutoLLMClient({ model: "gpt-5.5", clientType: "openai-official", apiKey: "your-openai-api-key" });
28
28
  // A compatible client, for any endpoint that serves OpenAI Chat Completions:
29
29
  // const client = new AutoLLMClient({ model: "custom-model", clientType: "openai-chat", baseUrl: "http://127.0.0.1:8000/v1/", apiKey: "none" });
30
- // For Gemini on Google Vertex AI, the service-account JSON key is the API key:
31
- // const client = new AutoLLMClient({ model: "gemini-3.8-flash", apiKey: fs.readFileSync("service-account.json", "utf8") });
30
+ // For Gemini on Google Vertex AI, the google-genai client, with the service-account JSON key as the API key:
31
+ // const client = new AutoLLMClient({ model: "gemini-3.8-flash", clientType: "google-genai", apiKey: fs.readFileSync("service-account.json", "utf8") });
32
32
 
33
33
  for await (const event of client.streamingResponseStateful({
34
34
  message: {
@@ -44,9 +44,9 @@ async function main() {
44
44
  main().catch(console.error);
45
45
  ```
46
46
 
47
- `clientType` names one of the official clients (`openai-official`, `anthropic-official`, `gemini-official`, `zai-official`, `moonshot-official`, `deepseek-official`, `minimax-official`) or one of the compatible clients (`openai-responses`, `openai-chat`, `openai-chat-vllm-adapter`, `openai-embedding`, `ant-messages`, `gemini-generate-content`). It may be omitted for a model id that begins with a known family (`gpt-`, `text-embedding-`, `claude-`, `gemini-`, `glm-`, `kimi-`, `deepseek-`, `minimax-`), which names its official client; any other id throws and asks for one.
47
+ `clientType` names one of the official clients (`openai-official`, `anthropic-official`, `gemini-official`, `zai-official`, `moonshot-official`, `deepseek-official`, `minimax-official`) or one of the compatible clients (`openai-responses`, `openai-chat`, `openai-chat-vllm-adapter`, `openai-embedding`, `ant-messages`, `google-genai`). It may be omitted for a model id that begins with a known family (`gpt-`, `text-embedding-`, `claude-`, `gemini-`, `glm-`, `kimi-`, `deepseek-`, `minimax-`), which names its official client; any other id throws and asks for one.
48
48
 
49
- A Vertex AI service-account key is served through generateContent, because Vertex AI's Interactions endpoint serves none of the Gemini models; any other Gemini key uses the Interactions API. `clientType: "gemini-generate-content"` names generateContent explicitly, for gateways that proxy it.
49
+ `gemini-official` speaks the Gemini API's Interactions endpoint. `google-genai` speaks generateContent, as the `@google/genai` SDK does, for Vertex AI (a service-account JSON key as the API key), the Gemini API, and gateways that proxy it; Vertex AI's Interactions endpoint serves none of the Gemini models, so a service-account key needs `google-genai`.
50
50
 
51
51
  Both streaming methods yield `delta` events, each carrying exactly one content item, then exactly one `stop` event, always last, carrying `usage_metadata` and `finish_reason`. Each item streams as one or more `.delta` fragments (`text.delta`, `tool_call.delta`, …) followed by its complete `.done` item (`text.done`, `tool_call.done`, …); items never interleave.
52
52
 
@@ -1,7 +1,7 @@
1
1
  import { LLMClient } from "./baseClient";
2
2
  import { UniConfig, UniEvent, UniMessage } from "./types";
3
3
  export declare const OFFICIAL_CLIENT_TYPES: readonly ["openai-official", "anthropic-official", "gemini-official", "zai-official", "moonshot-official", "deepseek-official", "minimax-official"];
4
- export declare const COMPATIBLE_CLIENT_TYPES: readonly ["openai-responses", "openai-chat", "openai-chat-vllm-adapter", "openai-embedding", "ant-messages", "gemini-generate-content"];
4
+ export declare const COMPATIBLE_CLIENT_TYPES: readonly ["openai-responses", "openai-chat", "openai-chat-vllm-adapter", "openai-embedding", "ant-messages", "google-genai"];
5
5
  export declare const MODEL_FAMILIES: [string, string][];
6
6
  /**
7
7
  * The official client a model id routes to on its own, or null when its family is unknown.
@@ -1 +1 @@
1
- {"version":3,"file":"autoClient.d.ts","sourceRoot":"","sources":["../src/autoClient.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAczC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAW1D,eAAO,MAAM,qBAAqB,qJAQxB,CAAC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AG;IAIvD;;OAEG;IAEH,+BAA+B,CAC7B,QAAQ,EAAE,UAAU,EAAE,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,GAAG;IAKN;;OAEG;IAEH,8BAA8B,CAAC,WAAW,EAAE,GAAG,GAAG,QAAQ;IAI1D;;OAEG;IAEI,0BAA0B,CAAC,QAAQ,EAAE,GAAG,GAAG,cAAc,CAAC,QAAQ,CAAC;IAI1E;;OAEG;IACI,iBAAiB,CAAC,OAAO,EAAE;QAChC,QAAQ,EAAE,UAAU,EAAE,CAAC;QACvB,MAAM,EAAE,SAAS,CAAC;QAClB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,cAAc,CAAC,QAAQ,CAAC;IAU5B;;OAEG;IACI,yBAAyB,CAAC,OAAO,EAAE;QACxC,OAAO,EAAE,UAAU,CAAC;QACpB,MAAM,EAAE,SAAS,CAAC;QAClB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,cAAc,CAAC,QAAQ,CAAC;IAU5B;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;OAEG;IACH,UAAU,IAAI,UAAU,EAAE;IAI1B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI;IAIvC;;;;;;;;OAQG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAStC"}
@@ -17,7 +17,7 @@ exports.AutoLLMClient = exports.MODEL_FAMILIES = exports.COMPATIBLE_CLIENT_TYPES
17
17
  exports.clientTypeForModel = clientTypeForModel;
18
18
  const baseClient_1 = require("./baseClient");
19
19
  const gemini_official_1 = require("./gemini_official");
20
- const gemini_generate_content_1 = require("./gemini_generate_content");
20
+ const google_genai_1 = require("./google_genai");
21
21
  const anthropic_official_1 = require("./anthropic_official");
22
22
  const openai_official_1 = require("./openai_official");
23
23
  const zai_official_1 = require("./zai_official");
@@ -47,7 +47,7 @@ exports.COMPATIBLE_CLIENT_TYPES = [
47
47
  "openai-chat-vllm-adapter",
48
48
  "openai-embedding",
49
49
  "ant-messages",
50
- "gemini-generate-content",
50
+ "google-genai",
51
51
  ];
52
52
  // Without a client type, the family a model id begins with names its official client.
53
53
  exports.MODEL_FAMILIES = [
@@ -84,9 +84,8 @@ function clientTypes() {
84
84
  *
85
85
  * @param clientType - A lowercased client type
86
86
  * @param model - The model id, which tells an official client's embedding models apart
87
- * @param apiKey - The key, which tells a Vertex AI service account apart
88
87
  */
89
- function clientClass(clientType, model, apiKey) {
88
+ function clientClass(clientType, model) {
90
89
  switch (clientType) {
91
90
  case "openai-official":
92
91
  // OpenAI serves embedding models through its Embeddings API
@@ -96,11 +95,7 @@ function clientClass(clientType, model, apiKey) {
96
95
  case "anthropic-official":
97
96
  return anthropic_official_1.AnthropicOfficialClient;
98
97
  case "gemini-official":
99
- // Vertex AI serves none of the Gemini models through the Interactions API, so a
100
- // service-account JSON key, which only Vertex AI takes, speaks generateContent
101
- return (apiKey || process.env.GEMINI_API_KEY || "").startsWith("{")
102
- ? gemini_generate_content_1.GeminiGenerateContentClient
103
- : gemini_official_1.GeminiOfficialClient;
98
+ return gemini_official_1.GeminiOfficialClient;
104
99
  case "zai-official":
105
100
  return zai_official_1.ZAIOfficialClient;
106
101
  case "moonshot-official":
@@ -120,8 +115,9 @@ function clientClass(clientType, model, apiKey) {
120
115
  return openai_embedding_1.OpenaiEmbeddingClient;
121
116
  case "ant-messages":
122
117
  return ant_messages_1.AntMessagesClient;
118
+ case "google-genai":
123
119
  case "gemini-generate-content":
124
- return gemini_generate_content_1.GeminiGenerateContentClient;
120
+ return google_genai_1.GoogleGenaiClient;
125
121
  default:
126
122
  return null;
127
123
  }
@@ -154,7 +150,7 @@ class AutoLLMClient extends baseClient_1.LLMClient {
154
150
  throw new Error(`No client for model ${JSON.stringify(options.model)}: its family is not known. ` +
155
151
  `Pass clientType, one of the ${clientTypes()}.`);
156
152
  }
157
- const ClientClass = clientClass(clientType, options.model, options.apiKey);
153
+ const ClientClass = clientClass(clientType, options.model);
158
154
  if (ClientClass === null) {
159
155
  throw new Error(`Unknown client type ${JSON.stringify(named)}. Pass one of the ${clientTypes()}.`);
160
156
  }
@@ -4,13 +4,13 @@ import { UniConfig, UniEvent, UniMessage } from "../types";
4
4
  type InteractionRequest = Omit<Interactions.CreateModelInteractionParamsStreaming, "input">;
5
5
  /**
6
6
  * Unified client for the Gemini family, named for the newest generation it
7
- * serves (3.8). It speaks the Interactions API statelessly (store=false, the
8
- * whole history in every request) for 3.8 back through the 3.x text, image,
9
- * and TTS models with an API key; Vertex AI is served by
10
- * gemini_generate_content. It embeds through embedContent, because the
11
- * Interactions API does not serve the embedding models, and applies the
12
- * 3.6-generation parameter contract to the whole family: temperature is
13
- * rejected everywhere.
7
+ * serves (3.8). It speaks the Gemini API's Interactions endpoint statelessly
8
+ * (store=false, the whole history in every request) for 3.8 back through the
9
+ * 3.x text, image, and TTS models. Vertex AI serves none of them through
10
+ * Interactions, so its service-account keys belong to google_genai. It
11
+ * embeds through embedContent, because the Interactions API does not serve
12
+ * the embedding models, and applies the 3.6-generation parameter contract to
13
+ * the whole family: temperature is rejected everywhere.
14
14
  *
15
15
  * Starting with the 3.6 generation the API deprecates the temperature/top_p/top_k
16
16
  * sampling parameters (silently ignored today, HTTP 400 in future
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/gemini_official/client.ts"],"names":[],"mappings":"AAcA,OAAO,EAIL,YAAY,EAEb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAOL,SAAS,EACT,QAAQ,EACR,UAAU,EAEX,MAAM,UAAU,CAAC;AAKlB,KAAK,kBAAkB,GAAG,IAAI,CAC5B,YAAY,CAAC,qCAAqC,EAClD,OAAO,CACR,CAAC;AAKF;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IACjD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACz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Ac,CAAC,QAAQ,CAAC;IAiE5B;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAatC"}
@@ -55,13 +55,13 @@ const types_1 = require("../types");
55
55
  const utils_1 = require("../utils");
56
56
  /**
57
57
  * Unified client for the Gemini family, named for the newest generation it
58
- * serves (3.8). It speaks the Interactions API statelessly (store=false, the
59
- * whole history in every request) for 3.8 back through the 3.x text, image,
60
- * and TTS models with an API key; Vertex AI is served by
61
- * gemini_generate_content. It embeds through embedContent, because the
62
- * Interactions API does not serve the embedding models, and applies the
63
- * 3.6-generation parameter contract to the whole family: temperature is
64
- * rejected everywhere.
58
+ * serves (3.8). It speaks the Gemini API's Interactions endpoint statelessly
59
+ * (store=false, the whole history in every request) for 3.8 back through the
60
+ * 3.x text, image, and TTS models. Vertex AI serves none of them through
61
+ * Interactions, so its service-account keys belong to google_genai. It
62
+ * embeds through embedContent, because the Interactions API does not serve
63
+ * the embedding models, and applies the 3.6-generation parameter contract to
64
+ * the whole family: temperature is rejected everywhere.
65
65
  *
66
66
  * Starting with the 3.6 generation the API deprecates the temperature/top_p/top_k
67
67
  * sampling parameters (silently ignored today, HTTP 400 in future
@@ -84,26 +84,15 @@ class GeminiOfficialClient extends baseClient_1.LLMClient {
84
84
  if (options.defaultHeaders) {
85
85
  httpOptions.headers = options.defaultHeaders;
86
86
  }
87
+ // a service-account key carries a private key, which must not travel as an API key header
87
88
  if (key && key.startsWith("{")) {
88
- const credentials = JSON.parse(key);
89
- const googleAuthOptions = {
90
- credentials,
91
- scopes: ["https://www.googleapis.com/auth/cloud-platform"],
92
- };
93
- this._client = new genai_1.GoogleGenAI({
94
- vertexai: true,
95
- location: "global",
96
- project: credentials.project_id,
97
- googleAuthOptions,
98
- httpOptions,
99
- });
100
- }
101
- else {
102
- this._client = new genai_1.GoogleGenAI({
103
- apiKey: key,
104
- httpOptions,
105
- });
89
+ throw new Error("GeminiOfficialClient does not serve a Vertex AI service-account key; " +
90
+ 'pass clientType: "google-genai" for Vertex AI.');
106
91
  }
92
+ this._client = new genai_1.GoogleGenAI({
93
+ apiKey: key,
94
+ httpOptions,
95
+ });
107
96
  }
108
97
  /**
109
98
  * Detect MIME type from URL extension for image.
@@ -2,10 +2,11 @@ import { Content, GenerateContentConfig, GenerateContentResponse } from "@google
2
2
  import { LLMClient } from "../baseClient";
3
3
  import { UniConfig, UniEvent, UniMessage } from "../types";
4
4
  /**
5
- * Client for the Gemini family through generateContent, named for the newest
6
- * generation it serves (3.8). It serves Gemini on Vertex AI, whose Interactions
7
- * endpoint serves none of these models, and gateways that proxy generateContent
8
- * only: 3.8 back through the 3.x text, image, TTS, and embedding models. It
5
+ * Compatible client for Google's generateContent protocol, as the google-genai
6
+ * SDK speaks it. It serves any endpoint that speaks generateContent: Vertex AI
7
+ * with a service-account JSON key, whose Interactions endpoint serves none of
8
+ * the Gemini models, the Gemini API, and gateways that proxy generateContent:
9
+ * Gemini 3.8 back through the 3.x text, image, TTS, and embedding models. It
9
10
  * applies the 3.6-generation parameter contract to the whole family:
10
11
  * temperature is rejected everywhere.
11
12
  *
@@ -13,11 +14,12 @@ import { UniConfig, UniEvent, UniMessage } from "../types";
13
14
  * sampling parameters (silently ignored today, HTTP 400 in future
14
15
  * generations), so this client rejects them instead of sending a no-op.
15
16
  */
16
- export declare class GeminiGenerateContentClient extends LLMClient {
17
+ export declare class GoogleGenaiClient extends LLMClient {
17
18
  protected _model: string;
18
19
  private _client;
19
20
  /**
20
- * Initialize Gemini 3.8 generateContent client with model and API key.
21
+ * Initialize the generateContent client with a model and an API key or
22
+ * service-account JSON key.
21
23
  */
22
24
  constructor(options: {
23
25
  model: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/google_genai/client.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,OAAO,EACP,qBAAqB,EAarB,uBAAuB,EAOxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,MAAM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,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAatC"}
@@ -46,7 +46,7 @@ var __importStar = (this && this.__importStar) || (function () {
46
46
  };
47
47
  })();
48
48
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.GeminiGenerateContentClient = void 0;
49
+ exports.GoogleGenaiClient = void 0;
50
50
  const genai_1 = require("@google/genai");
51
51
  const path = __importStar(require("path"));
52
52
  const baseClient_1 = require("../baseClient");
@@ -73,10 +73,11 @@ function splitFunctionResponseRuns(parts) {
73
73
  return runs.length > 0 ? runs : [parts];
74
74
  }
75
75
  /**
76
- * Client for the Gemini family through generateContent, named for the newest
77
- * generation it serves (3.8). It serves Gemini on Vertex AI, whose Interactions
78
- * endpoint serves none of these models, and gateways that proxy generateContent
79
- * only: 3.8 back through the 3.x text, image, TTS, and embedding models. It
76
+ * Compatible client for Google's generateContent protocol, as the google-genai
77
+ * SDK speaks it. It serves any endpoint that speaks generateContent: Vertex AI
78
+ * with a service-account JSON key, whose Interactions endpoint serves none of
79
+ * the Gemini models, the Gemini API, and gateways that proxy generateContent:
80
+ * Gemini 3.8 back through the 3.x text, image, TTS, and embedding models. It
80
81
  * applies the 3.6-generation parameter contract to the whole family:
81
82
  * temperature is rejected everywhere.
82
83
  *
@@ -84,15 +85,15 @@ function splitFunctionResponseRuns(parts) {
84
85
  * sampling parameters (silently ignored today, HTTP 400 in future
85
86
  * generations), so this client rejects them instead of sending a no-op.
86
87
  */
87
- class GeminiGenerateContentClient extends baseClient_1.LLMClient {
88
+ class GoogleGenaiClient extends baseClient_1.LLMClient {
88
89
  /**
89
- * Initialize Gemini 3.8 generateContent client with model and API key.
90
+ * Initialize the generateContent client with a model and an API key or
91
+ * service-account JSON key.
90
92
  */
91
93
  constructor(options) {
92
94
  super();
93
95
  this._model = options.model;
94
- const key = options.apiKey || process.env.GEMINI_API_KEY || undefined;
95
- const url = options.baseUrl || process.env.GEMINI_BASE_URL || undefined;
96
+ const { apiKey: key, baseUrl: url } = (0, utils_1.resolveCredentials)(this.constructor.name, options, { key: "GEMINI_API_KEY", baseUrl: "GEMINI_BASE_URL" });
96
97
  // the Gemini SDK carries connection headers inside httpOptions rather than its own argument
97
98
  const httpOptions = {};
98
99
  if (url) {
@@ -201,7 +202,7 @@ class GeminiGenerateContentClient extends baseClient_1.LLMClient {
201
202
  genai_1.ThinkingLevel.HIGH,
202
203
  ];
203
204
  }
204
- return GeminiGenerateContentClient.GEMINI_LEVEL_ORDER;
205
+ return GoogleGenaiClient.GEMINI_LEVEL_ORDER;
205
206
  }
206
207
  /**
207
208
  * Convert ThinkingLevel enum to the closest Gemini ThinkingLevel the model supports.
@@ -236,7 +237,7 @@ class GeminiGenerateContentClient extends baseClient_1.LLMClient {
236
237
  // e.g. MEDIUM becomes HIGH on gemini-3-pro and NONE maps to LOW on
237
238
  // gemini-3.7-flash. `supported` is non-empty here, so the
238
239
  // initial-value-less reduce cannot throw.
239
- const order = GeminiGenerateContentClient.GEMINI_LEVEL_ORDER;
240
+ const order = GoogleGenaiClient.GEMINI_LEVEL_ORDER;
240
241
  const index = order.indexOf(level);
241
242
  return supported.reduce((best, candidate) => {
242
243
  const bestDistance = Math.abs(order.indexOf(best) - index);
@@ -798,10 +799,10 @@ class GeminiGenerateContentClient extends baseClient_1.LLMClient {
798
799
  return models;
799
800
  }
800
801
  }
801
- exports.GeminiGenerateContentClient = GeminiGenerateContentClient;
802
+ exports.GoogleGenaiClient = GoogleGenaiClient;
802
803
  // Gemini thinking levels from weakest to strongest, used to pick the
803
804
  // closest supported level when a model rejects the requested one.
804
- GeminiGenerateContentClient.GEMINI_LEVEL_ORDER = [
805
+ GoogleGenaiClient.GEMINI_LEVEL_ORDER = [
805
806
  genai_1.ThinkingLevel.MINIMAL,
806
807
  genai_1.ThinkingLevel.LOW,
807
808
  genai_1.ThinkingLevel.MEDIUM,
@@ -0,0 +1,2 @@
1
+ export { GoogleGenaiClient } from "./client";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/google_genai/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
@@ -13,6 +13,6 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.GeminiGenerateContentClient = void 0;
16
+ exports.GoogleGenaiClient = void 0;
17
17
  var client_1 = require("./client");
18
- Object.defineProperty(exports, "GeminiGenerateContentClient", { enumerable: true, get: function () { return client_1.GeminiGenerateContentClient; } });
18
+ Object.defineProperty(exports, "GoogleGenaiClient", { enumerable: true, get: function () { return client_1.GoogleGenaiClient; } });
@@ -110,7 +110,7 @@ const DEFAULT_BASE_URLS = {
110
110
  "openai-chat-vllm-adapter": ["OPENAI_BASE_URL", "https://api.openai.com/v1"],
111
111
  "openai-embedding": ["OPENAI_BASE_URL", "https://api.openai.com/v1"],
112
112
  "ant-messages": ["ANTHROPIC_BASE_URL", "https://api.anthropic.com"],
113
- "gemini-generate-content": [
113
+ "google-genai": [
114
114
  "GEMINI_BASE_URL",
115
115
  "https://generativelanguage.googleapis.com",
116
116
  ],
@@ -148,7 +148,7 @@ function createChatApp() {
148
148
  <title>MMSP Playground</title>
149
149
  <meta charset="utf-8">
150
150
  <meta name="viewport" content="width=device-width, initial-scale=1">
151
- <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22%3E%3Cstyle%3E.d{fill:%23111116}@media (prefers-color-scheme: dark){.d{fill:%232a2a33}}%3C/style%3E%3Crect width=%2232%22 height=%2232%22 rx=%227%22 class=%22d%22/%3E%3Cpath d=%22M0 16V7a7 7 0 0 1 7-7h9v16Z%22 fill=%22%237c4dff%22/%3E%3Cpath d=%22M16 16h16v9a7 7 0 0 1-7 7h-9Z%22 fill=%22%237c4dff%22/%3E%3Cg fill=%22%23fff%22 font-family=%22ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif%22 font-size=%2210.5%22 font-weight=%22700%22 text-anchor=%22middle%22 dominant-baseline=%22central%22%3E%3Ctext x=%228.5%22 y=%228.5%22%3EM%3C/text%3E%3Ctext x=%2223.5%22 y=%228.5%22%3EM%3C/text%3E%3Ctext x=%228.5%22 y=%2223.5%22%3ES%3C/text%3E%3Ctext x=%2223.5%22 y=%2223.5%22%3EP%3C/text%3E%3C/g%3E%3C/svg%3E">
151
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22%3E%3Cstyle%3E.d{fill:%23111116}@media (prefers-color-scheme: dark){.d{fill:%232a2a33}}%3C/style%3E%3Cpath d=%22M15.5 0H25a7 7 0 0 1 7 7v9.5H15.5Z%22 class=%22d%22/%3E%3Cpath d=%22M0 15.5h16.5V32H7a7 7 0 0 1-7-7Z%22 class=%22d%22/%3E%3Cpath d=%22M0 16V7a7 7 0 0 1 7-7h9v16Z%22 fill=%22%23477dfb%22/%3E%3Cpath d=%22M16 16h16v9a7 7 0 0 1-7 7h-9Z%22 fill=%22%23477dfb%22/%3E%3Cg fill=%22%23fff%22 font-family=%22ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif%22 font-size=%2210.5%22 font-weight=%22700%22 text-anchor=%22middle%22 dominant-baseline=%22central%22%3E%3Ctext x=%228.5%22 y=%228.5%22%3EM%3C/text%3E%3Ctext x=%2223.5%22 y=%228.5%22%3EM%3C/text%3E%3Ctext x=%228.5%22 y=%2223.5%22%3ES%3C/text%3E%3Ctext x=%2223.5%22 y=%2223.5%22%3EP%3C/text%3E%3C/g%3E%3C/svg%3E">
152
152
  <link rel="preconnect" href="https://fonts.googleapis.com">
153
153
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
154
154
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap">
@@ -1461,7 +1461,7 @@ function createChatApp() {
1461
1461
  <aside class="sidebar" id="configPanel" aria-label="Settings">
1462
1462
  <div class="sidebar-head">
1463
1463
  <div class="brand">
1464
- <svg class="brand-mark" viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="7" class="mark-bg"></rect><path d="M0 16V7a7 7 0 0 1 7-7h9v16Z" fill="#7c4dff"></path><path d="M16 16h16v9a7 7 0 0 1-7 7h-9Z" fill="#7c4dff"></path><g fill="#fff" font-family="ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" font-size="10.5" font-weight="700" text-anchor="middle" dominant-baseline="central"><text x="8.5" y="8.5">M</text><text x="23.5" y="8.5">M</text><text x="8.5" y="23.5">S</text><text x="23.5" y="23.5">P</text></g></svg>
1464
+ <svg class="brand-mark" viewBox="0 0 32 32" aria-hidden="true"><path d="M15.5 0H25a7 7 0 0 1 7 7v9.5H15.5Z" class="mark-bg"></path><path d="M0 15.5h16.5V32H7a7 7 0 0 1-7-7Z" class="mark-bg"></path><path d="M0 16V7a7 7 0 0 1 7-7h9v16Z" fill="#477dfb"></path><path d="M16 16h16v9a7 7 0 0 1-7 7h-9Z" fill="#477dfb"></path><g fill="#fff" font-family="ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" font-size="10.5" font-weight="700" text-anchor="middle" dominant-baseline="central"><text x="8.5" y="8.5">M</text><text x="23.5" y="8.5">M</text><text x="8.5" y="23.5">S</text><text x="23.5" y="23.5">P</text></g></svg>
1465
1465
  <h1 class="brand-name">MMSP</h1>
1466
1466
  <span class="brand-sub">Playground</span>
1467
1467
  </div>
@@ -2223,7 +2223,7 @@ function createChatApp() {
2223
2223
  'openai-chat-vllm-adapter': 'Chat Completions on vLLM',
2224
2224
  'openai-embedding': 'OpenAI Embeddings',
2225
2225
  'ant-messages': 'Anthropic Messages',
2226
- 'gemini-generate-content': 'Gemini generateContent'
2226
+ 'google-genai': 'Google generateContent'
2227
2227
  };
2228
2228
 
2229
2229
  function clientTypeOption(value, label, description) {
@@ -64,7 +64,7 @@ const legacy_1 = require("../legacy");
64
64
  const TRACER_HEAD = `
65
65
  <meta charset="utf-8">
66
66
  <meta name="viewport" content="width=device-width, initial-scale=1">
67
- <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22%3E%3Cstyle%3E.d{fill:%23111116}@media (prefers-color-scheme: dark){.d{fill:%232a2a33}}%3C/style%3E%3Crect width=%2232%22 height=%2232%22 rx=%227%22 class=%22d%22/%3E%3Cpath d=%22M0 16V7a7 7 0 0 1 7-7h9v16Z%22 fill=%22%237c4dff%22/%3E%3Cpath d=%22M16 16h16v9a7 7 0 0 1-7 7h-9Z%22 fill=%22%237c4dff%22/%3E%3Cg fill=%22%23fff%22 font-family=%22ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif%22 font-size=%2210.5%22 font-weight=%22700%22 text-anchor=%22middle%22 dominant-baseline=%22central%22%3E%3Ctext x=%228.5%22 y=%228.5%22%3EM%3C/text%3E%3Ctext x=%2223.5%22 y=%228.5%22%3EM%3C/text%3E%3Ctext x=%228.5%22 y=%2223.5%22%3ES%3C/text%3E%3Ctext x=%2223.5%22 y=%2223.5%22%3EP%3C/text%3E%3C/g%3E%3C/svg%3E">
67
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22%3E%3Cstyle%3E.d{fill:%23111116}@media (prefers-color-scheme: dark){.d{fill:%232a2a33}}%3C/style%3E%3Cpath d=%22M15.5 0H25a7 7 0 0 1 7 7v9.5H15.5Z%22 class=%22d%22/%3E%3Cpath d=%22M0 15.5h16.5V32H7a7 7 0 0 1-7-7Z%22 class=%22d%22/%3E%3Cpath d=%22M0 16V7a7 7 0 0 1 7-7h9v16Z%22 fill=%22%23477dfb%22/%3E%3Cpath d=%22M16 16h16v9a7 7 0 0 1-7 7h-9Z%22 fill=%22%23477dfb%22/%3E%3Cg fill=%22%23fff%22 font-family=%22ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif%22 font-size=%2210.5%22 font-weight=%22700%22 text-anchor=%22middle%22 dominant-baseline=%22central%22%3E%3Ctext x=%228.5%22 y=%228.5%22%3EM%3C/text%3E%3Ctext x=%2223.5%22 y=%228.5%22%3EM%3C/text%3E%3Ctext x=%228.5%22 y=%2223.5%22%3ES%3C/text%3E%3Ctext x=%2223.5%22 y=%2223.5%22%3EP%3C/text%3E%3C/g%3E%3C/svg%3E">
68
68
  <link rel="preconnect" href="https://fonts.googleapis.com">
69
69
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
70
70
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap">
@@ -1123,7 +1123,7 @@ const TRACER_SCRIPT = `
1123
1123
  </script>
1124
1124
  `;
1125
1125
  const ICONS = {
1126
- mark: '<svg class="brand-mark" viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="7" class="mark-bg"></rect><path d="M0 16V7a7 7 0 0 1 7-7h9v16Z" fill="#7c4dff"></path><path d="M16 16h16v9a7 7 0 0 1-7 7h-9Z" fill="#7c4dff"></path><g fill="#fff" font-family="ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" font-size="10.5" font-weight="700" text-anchor="middle" dominant-baseline="central"><text x="8.5" y="8.5">M</text><text x="23.5" y="8.5">M</text><text x="8.5" y="23.5">S</text><text x="23.5" y="23.5">P</text></g></svg>',
1126
+ mark: '<svg class="brand-mark" viewBox="0 0 32 32" aria-hidden="true"><path d="M15.5 0H25a7 7 0 0 1 7 7v9.5H15.5Z" class="mark-bg"></path><path d="M0 15.5h16.5V32H7a7 7 0 0 1-7-7Z" class="mark-bg"></path><path d="M0 16V7a7 7 0 0 1 7-7h9v16Z" fill="#477dfb"></path><path d="M16 16h16v9a7 7 0 0 1-7 7h-9Z" fill="#477dfb"></path><g fill="#fff" font-family="ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" font-size="10.5" font-weight="700" text-anchor="middle" dominant-baseline="central"><text x="8.5" y="8.5">M</text><text x="23.5" y="8.5">M</text><text x="8.5" y="23.5">S</text><text x="23.5" y="23.5">P</text></g></svg>',
1127
1127
  github: '<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2a10 10 0 0 0-3.16 19.49c.5.09.68-.22.68-.48v-1.7c-2.78.6-3.37-1.34-3.37-1.34-.45-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.61.07-.61 1 .07 1.53 1.03 1.53 1.03.9 1.52 2.34 1.08 2.91.83.09-.65.35-1.08.63-1.33-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.98 1.03-2.68-.1-.25-.45-1.27.1-2.64 0 0 .84-.27 2.75 1.02a9.6 9.6 0 0 1 5 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.37.2 2.39.1 2.64.64.7 1.03 1.59 1.03 2.68 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85v2.74c0 .27.18.58.69.48A10 10 0 0 0 12 2Z"></path></svg>',
1128
1128
  sun: '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"></circle><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"></path></svg>',
1129
1129
  moon: '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"></path></svg>',
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AACtE,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,QAAQ,EAAE,CAAC;IAC7B,iBAAiB,EAAE,QAAQ,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AA0wBD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,GAAE,QAAgB,GACzB,cAAc,EAAE,CASlB"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AACtE,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,QAAQ,EAAE,CAAC;IAC7B,iBAAiB,EAAE,QAAQ,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAywBD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,GAAE,QAAgB,GACzB,cAAc,EAAE,CASlB"}
package/dist/registry.js CHANGED
@@ -603,13 +603,13 @@ const SUPPORTED_MODELS = [
603
603
  pricing: usd(5.0, 30.0, 0.5),
604
604
  },
605
605
  {
606
- model: "qwen/qwen3.6-35b-a3b",
606
+ model: "qwen/qwen3.8-27b",
607
607
  base_url: OPENROUTER,
608
608
  client: "openai-responses",
609
609
  input_modalities: ["Text", "Image"],
610
610
  output_modalities: ["Text"],
611
- context_window: 262144,
612
- pricing: usd(0.14, 1.0),
611
+ context_window: 1000000,
612
+ pricing: usd(0.42, 3.0, 0.085),
613
613
  },
614
614
  {
615
615
  model: "qwen/qwen3-embedding-4b",
@@ -746,12 +746,11 @@ const SUPPORTED_MODELS = [
746
746
  context_window: 262144,
747
747
  },
748
748
  {
749
- model: "Qwen/Qwen3.6-35B-A3B",
749
+ model: "Qwen/Qwen3.8-27B",
750
750
  base_url: SILICONFLOW,
751
751
  client: "openai-chat",
752
752
  input_modalities: ["Text", "Image"],
753
753
  output_modalities: ["Text"],
754
- context_window: 262144,
755
754
  },
756
755
  {
757
756
  model: "Qwen/Qwen3-Embedding-8B",
package/dist/utils.d.ts CHANGED
@@ -19,8 +19,8 @@ export declare function fixOpenrouterUsageMetadata(usageMetadata: UsageMetadata,
19
19
  * @returns Whether debug mode is on.
20
20
  */
21
21
  /**
22
- * The key and the endpoint of a client that reads the environment's OPENAI_API_KEY or
23
- * ANTHROPIC_API_KEY. A key passed in is used as it is. Without one, the environment's key goes
22
+ * The key and the endpoint of a client that reads the environment's OPENAI_API_KEY,
23
+ * ANTHROPIC_API_KEY or GEMINI_API_KEY. A key passed in is used as it is. Without one, the environment's key goes
24
24
  * out only to the endpoint the environment names: a base URL passed in is another endpoint,
25
25
  * which that key was not given for, so it needs a key of its own.
26
26
  *
package/dist/utils.js CHANGED
@@ -49,8 +49,8 @@ function fixOpenrouterUsageMetadata(usageMetadata, baseUrl) {
49
49
  * @returns Whether debug mode is on.
50
50
  */
51
51
  /**
52
- * The key and the endpoint of a client that reads the environment's OPENAI_API_KEY or
53
- * ANTHROPIC_API_KEY. A key passed in is used as it is. Without one, the environment's key goes
52
+ * The key and the endpoint of a client that reads the environment's OPENAI_API_KEY,
53
+ * ANTHROPIC_API_KEY or GEMINI_API_KEY. A key passed in is used as it is. Without one, the environment's key goes
54
54
  * out only to the endpoint the environment names: a base URL passed in is another endpoint,
55
55
  * which that key was not given for, so it needs a key of its own.
56
56
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismshadow/mmsp",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "MMSP, the Model Message Stream Protocol: one message format and one streaming grammar for every model provider, in Python and TypeScript.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/gemini_generate_content/client.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,OAAO,EACP,qBAAqB,EAarB,uBAAuB,EAOxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAOL,SAAS,EACT,QAAQ,EACR,UAAU,EAEX,MAAM,UAAU,CAAC;AAuBlB;;;;;;;;;;;GAWG;AACH,qBAAa,2BAA4B,SAAQ,SAAS;IACxD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,OAAO,CAAc;IAE7B;;OAEG;gBACS,OAAO,EAAE;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACzC;IAmCD;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;YACW,yBAAyB;IA4BvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAKxC;IAEF;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAkChC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA4C7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,gBAAgB;IAUxB;;OAEG;IACH,+BAA+B,CAC7B,MAAM,EAAE,SAAS,GAChB,qBAAqB,GAAG,SAAS;IA2HpC;;OAEG;IACG,+BAA+B,CACnC,QAAQ,EAAE,UAAU,EAAE,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,EAAE,CAAC;IAwLrB;;;;;;;OAOG;IACH,8BAA8B,CAC5B,WAAW,EAAE,uBAAuB,GACnC,QAAQ;YA2FI,sBAAsB;IAoFrC;;OAEG;IACI,0BAA0B,CAAC,OAAO,EAAE;QACzC,QAAQ,EAAE,UAAU,EAAE,CAAC;QACvB,MAAM,EAAE,SAAS,CAAC;QAClB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,cAAc,CAAC,QAAQ,CAAC;IA+E5B;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAatC"}
@@ -1,2 +0,0 @@
1
- export { GeminiGenerateContentClient } from "./client";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gemini_generate_content/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC"}