genai-lite 0.4.1 → 0.4.2

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.
@@ -143,6 +143,19 @@ class LLMService {
143
143
  object: "error",
144
144
  };
145
145
  }
146
+ // Validate API key format if adapter supports it
147
+ if (clientAdapter.validateApiKey && !clientAdapter.validateApiKey(apiKey)) {
148
+ return {
149
+ provider: providerId,
150
+ model: modelId,
151
+ error: {
152
+ message: `Invalid API key format for provider '${providerId}'. Please check your API key.`,
153
+ code: "INVALID_API_KEY",
154
+ type: "authentication_error",
155
+ },
156
+ object: "error",
157
+ };
158
+ }
146
159
  console.log(`Making LLM request with ${clientAdapter.constructor.name} for provider: ${providerId}`);
147
160
  const result = await clientAdapter.sendMessage(internalRequest, apiKey);
148
161
  // Post-process for thinking tag fallback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genai-lite",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "A lightweight, portable toolkit for interacting with various Generative AI APIs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",