swarm-code 0.1.8 → 0.1.9
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.
|
@@ -21,14 +21,22 @@ const DEFAULT_MODELS = {
|
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
23
|
* Create a synthetic pi-ai Model for Ollama (OpenAI-compatible API at localhost:11434).
|
|
24
|
+
*
|
|
25
|
+
* Uses provider "openai" so pi-ai's API key lookup resolves to OPENAI_API_KEY.
|
|
26
|
+
* We set a dummy OPENAI_API_KEY if none exists — Ollama ignores auth headers.
|
|
24
27
|
*/
|
|
25
28
|
function createOllamaModel(modelId) {
|
|
26
29
|
const shortId = modelId.replace("ollama/", "");
|
|
30
|
+
// pi-ai requires an API key for the "openai" provider. Ollama doesn't need one,
|
|
31
|
+
// but we must satisfy pi-ai's check. Set a dummy key if no real one exists.
|
|
32
|
+
if (!process.env.OPENAI_API_KEY) {
|
|
33
|
+
process.env.OPENAI_API_KEY = "ollama-local";
|
|
34
|
+
}
|
|
27
35
|
return {
|
|
28
36
|
id: shortId,
|
|
29
37
|
name: shortId,
|
|
30
38
|
api: "openai-completions",
|
|
31
|
-
provider: "
|
|
39
|
+
provider: "openai",
|
|
32
40
|
baseUrl: "http://localhost:11434/v1",
|
|
33
41
|
reasoning: false,
|
|
34
42
|
input: ["text"],
|
package/package.json
CHANGED