@crazy-goat/nexos-provider 1.0.0 → 1.2.0
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 +16 -0
- package/list-models.mjs +47 -0
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -80,6 +80,22 @@ opencode run "hello" -m "nexos-gemini/Gemini 2.5 Pro"
|
|
|
80
80
|
|
|
81
81
|
Or select the model interactively in opencode with `Ctrl+X M`.
|
|
82
82
|
|
|
83
|
+
## Listing available models
|
|
84
|
+
|
|
85
|
+
To see all models available on nexos.ai:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx @crazy-goat/nexos-provider
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Or if you have the repo cloned:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm run list-models
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Requires `NEXOS_API_KEY` to be set.
|
|
98
|
+
|
|
83
99
|
## GPT and Claude models
|
|
84
100
|
|
|
85
101
|
GPT and Claude models work fine through nexos.ai without this provider — they correctly emit `data: [DONE]` and handle `$ref` schemas. Use the standard `@ai-sdk/openai-compatible` provider for those:
|
package/list-models.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const baseURL = process.env.NEXOS_BASE_URL || "https://api.nexos.ai/v1";
|
|
4
|
+
const apiKey = process.env.NEXOS_API_KEY;
|
|
5
|
+
|
|
6
|
+
if (!apiKey) {
|
|
7
|
+
console.error("Error: NEXOS_API_KEY environment variable is not set");
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const res = await fetch(`${baseURL}/models`, {
|
|
12
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (!res.ok) {
|
|
16
|
+
console.error(`Error: ${res.status} ${res.statusText}`);
|
|
17
|
+
const body = await res.text();
|
|
18
|
+
if (body) console.error(body);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const data = await res.json();
|
|
23
|
+
const models = (data.data || data.models || []).sort((a, b) =>
|
|
24
|
+
(a.id || a.name || "").localeCompare(b.id || b.name || "")
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (models.length === 0) {
|
|
28
|
+
console.log("No models found.");
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log(`\nAvailable models (${models.length}):\n`);
|
|
33
|
+
|
|
34
|
+
for (const m of models) {
|
|
35
|
+
const id = m.id || m.name;
|
|
36
|
+
console.log(` - ${id}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log("\nTo use a model in opencode.json, add it under provider.models:");
|
|
40
|
+
console.log(`
|
|
41
|
+
"models": {
|
|
42
|
+
"<model-id>": {
|
|
43
|
+
"name": "<model-id>",
|
|
44
|
+
"limit": { "context": 128000, "output": 64000 }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`);
|
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crazy-goat/nexos-provider",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Custom AI SDK provider for nexos.ai Gemini models in opencode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.mjs",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.mjs"
|
|
9
9
|
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"nexos-provider": "./list-models.mjs"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"list-models": "node list-models.mjs"
|
|
15
|
+
},
|
|
10
16
|
"files": [
|
|
11
|
-
"index.mjs"
|
|
17
|
+
"index.mjs",
|
|
18
|
+
"list-models.mjs"
|
|
12
19
|
],
|
|
13
20
|
"keywords": [
|
|
14
21
|
"opencode",
|