@neon/ai-sdk-provider 1.3.0 → 1.3.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 +3 -3
- package/dist/lib/neon-anthropic-language-model.d.ts +1 -2
- package/dist/lib/neon-anthropic-language-model.js +1 -2
- package/dist/lib/neon-capabilities.d.ts +1 -2
- package/dist/lib/neon-capabilities.js +1 -2
- package/dist/lib/neon-chat-language-model.d.ts +1 -2
- package/dist/lib/neon-chat-language-model.js +1 -2
- package/dist/lib/neon-chat-options.d.ts +1 -3
- package/dist/lib/neon-chat-options.d.ts.map +1 -1
- package/dist/lib/neon-chat-options.js +1 -3
- package/dist/lib/neon-chat-options.js.map +1 -1
- package/dist/lib/neon-decision-model.d.ts +1 -2
- package/dist/lib/neon-decision-model.js +1 -2
- package/dist/lib/neon-embedding-options.d.ts +0 -2
- package/dist/lib/neon-embedding-options.d.ts.map +1 -1
- package/dist/lib/neon-embedding-options.js +1 -2
- package/dist/lib/neon-gateway-error.d.ts +1 -2
- package/dist/lib/neon-gateway-error.js +1 -2
- package/dist/lib/neon-harmony-normalize.d.ts +1 -2
- package/dist/lib/neon-harmony-normalize.js +1 -2
- package/dist/lib/neon-model-capabilities.d.ts +0 -2
- package/dist/lib/neon-model-capabilities.d.ts.map +1 -1
- package/dist/lib/neon-model-capabilities.js +2 -3
- package/dist/lib/neon-model-capabilities.js.map +1 -1
- package/dist/lib/neon-openai-tools.d.ts +1 -2
- package/dist/lib/neon-openai-tools.js +1 -2
- package/dist/lib/neon-responses-language-model.d.ts +1 -2
- package/dist/lib/neon-responses-language-model.js +1 -2
- package/dist/lib/neon-responses-options.d.ts +1 -2
- package/dist/lib/neon-responses-options.js +1 -2
- package/dist/lib/provider.d.ts +1 -2
- package/dist/lib/provider.js +1 -2
- package/dist/lib/version.d.ts +0 -2
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +1 -2
- package/dist/package.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ Routing matches on the model id.
|
|
|
59
59
|
|
|
60
60
|
## Capabilities
|
|
61
61
|
|
|
62
|
-
`generateText` and `streamText` work with any text model available to your branch. `generateObject`, `streamObject`, and single- or multi-step tool calls work with OpenAI (including Codex), Meta, Alibaba, Zhipu AI
|
|
62
|
+
`generateText` and `streamText` work with any text model available to your branch. `generateObject`, `streamObject`, and single- or multi-step tool calls work with OpenAI (including Codex), Meta, Alibaba, and Zhipu AI models. Gemini currently supports `generateText` and `streamText`; structured output and multi-step tools are not supported. Vision input works on models that accept images.
|
|
63
63
|
|
|
64
64
|
Claude models use the Messages API. On both that route and Chat Completions the provider removes call options the gateway rejects and reports each one in `result.warnings` instead of failing the request — see [Dropped call options](#dropped-call-options). Unsupported Responses API storage options throw before a request is sent — see [Errors](#errors).
|
|
65
65
|
|
|
@@ -77,7 +77,7 @@ These rules apply on the Anthropic Messages and Chat Completions routes. The Res
|
|
|
77
77
|
| All Claude | `frequencyPenalty`, `presencePenalty`, `seed`, `reasoningEffort`, and `topP` when you set both `temperature` and `topP` (Anthropic accepts only one) |
|
|
78
78
|
| `gpt-oss` | `frequencyPenalty`, `presencePenalty`, `seed`, `stopSequences` |
|
|
79
79
|
| Qwen, Gemma | `frequencyPenalty`, `presencePenalty`, `seed` |
|
|
80
|
-
| `glm-5-2`, `glm-5-3`, `glm-5-3-flash`, `
|
|
80
|
+
| `glm-5-2`, `glm-5-3`, `glm-5-3-flash`, `kimi-k3` | `frequencyPenalty`, `presencePenalty` |
|
|
81
81
|
| Grok, DeepSeek | `frequencyPenalty`, `presencePenalty` |
|
|
82
82
|
| Meta Llama | `frequencyPenalty`, `presencePenalty`, `seed` |
|
|
83
83
|
| `gemini-3-5-flash-lite` | `frequencyPenalty`, `presencePenalty` |
|
|
@@ -285,4 +285,4 @@ pnpm test:e2e
|
|
|
285
285
|
|
|
286
286
|
A run with neither **fails**; it does not skip. The gateway is on every branch and needs no provisioning, so the API-key path is the one CI uses — no gateway token is stored as a secret.
|
|
287
287
|
|
|
288
|
-
The matrix covers one published catalog model per family (Anthropic, OpenAI, Codex, Gemini, Meta, Alibaba, Zhipu
|
|
288
|
+
The matrix covers one published catalog model per family (Anthropic, OpenAI, Codex, Gemini, Meta, Alibaba, Zhipu) across `generateText`, `streamText`, `generateObject`, tool calling, and `neon.tools.imageGeneration`. `generateObject` and tool calling run on the subset of families where they are verified (see [Capabilities](#capabilities)). A family whose representative id the branch does not serve skips its cases, and a single assertion fails the run listing exactly which pinned ids went missing — so a shrinking catalog is reported rather than silently reducing coverage. Model access is granted per account, so the account behind the key needs every id in `MATRIX_MODELS`. The suite also fetches the live `/v1/models` catalog and calls every currently enabled text model with `generateText` and every embedding model with `embed` and `embedMany`, on both AI SDK 6 and AI SDK 7.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnthropicMessagesLanguageModel } from "@ai-sdk/anthropic/internal";
|
|
2
2
|
import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult } from "@ai-sdk/provider";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/neon-anthropic-language-model.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Language model for Anthropic models served via the Neon AI Gateway's native
|
|
@@ -26,6 +26,5 @@ declare class NeonAnthropicLanguageModel extends AnthropicMessagesLanguageModel
|
|
|
26
26
|
doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
|
|
27
27
|
doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { NeonAnthropicLanguageModel };
|
|
31
30
|
//# sourceMappingURL=neon-anthropic-language-model.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { applyNeonCapabilities, mergeStreamStartWarnings } from "./neon-capabilities.js";
|
|
2
2
|
import { AnthropicMessagesLanguageModel } from "@ai-sdk/anthropic/internal";
|
|
3
|
-
|
|
3
|
+
// src/lib/neon-anthropic-language-model.ts
|
|
4
4
|
/**
|
|
5
5
|
* Language model for Anthropic models served via the Neon AI Gateway's native
|
|
6
6
|
* Messages API (`/anthropic/v1/messages`). Unlocks streaming
|
|
@@ -58,7 +58,6 @@ var NeonAnthropicLanguageModel = class extends AnthropicMessagesLanguageModel {
|
|
|
58
58
|
} : result;
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
//#endregion
|
|
62
61
|
export { NeonAnthropicLanguageModel };
|
|
63
62
|
|
|
64
63
|
//# sourceMappingURL=neon-anthropic-language-model.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LanguageModelV3CallOptions, LanguageModelV3StreamPart, SharedV3Warning } from "@ai-sdk/provider";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/lib/neon-capabilities.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Drop call options the resolved model's upstream backend does not accept and
|
|
@@ -15,6 +15,5 @@ declare function applyNeonCapabilities(modelId: string, options: LanguageModelV3
|
|
|
15
15
|
* Merge additional warnings into the `stream-start` part of a model stream.
|
|
16
16
|
*/
|
|
17
17
|
declare function mergeStreamStartWarnings(extra: SharedV3Warning[]): TransformStream<LanguageModelV3StreamPart, LanguageModelV3StreamPart>;
|
|
18
|
-
//#endregion
|
|
19
18
|
export { applyNeonCapabilities, mergeStreamStartWarnings };
|
|
20
19
|
//# sourceMappingURL=neon-capabilities.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getNeonModelCapabilities } from "./neon-model-capabilities.js";
|
|
2
|
-
|
|
2
|
+
// src/lib/neon-capabilities.ts
|
|
3
3
|
const PENALTY_DETAILS = "The request was sent without it. Check getNeonModelCapabilities('<model-id>').supportsPenalties before setting penalties.";
|
|
4
4
|
const GENERIC_DETAILS = "The request was sent without it. Call getNeonModelCapabilities('<model-id>') to see which sampling parameters this model takes, or steer it through the prompt.";
|
|
5
5
|
const REASONING_EFFORT_DETAILS = "The request was sent without it. Claude takes providerOptions.anthropic.effort instead.";
|
|
@@ -97,7 +97,6 @@ function mergeStreamStartWarnings(extra) {
|
|
|
97
97
|
} else controller.enqueue(part);
|
|
98
98
|
} });
|
|
99
99
|
}
|
|
100
|
-
//#endregion
|
|
101
100
|
export { applyNeonCapabilities, mergeStreamStartWarnings };
|
|
102
101
|
|
|
103
102
|
//# sourceMappingURL=neon-capabilities.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAICompatibleChatLanguageModel } from "@ai-sdk/openai-compatible";
|
|
2
2
|
import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult } from "@ai-sdk/provider";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/neon-chat-language-model.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Language model for the Neon AI Gateway unified (MLflow) endpoint.
|
|
@@ -16,6 +16,5 @@ declare class NeonChatLanguageModel extends OpenAICompatibleChatLanguageModel im
|
|
|
16
16
|
doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
|
|
17
17
|
doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { NeonChatLanguageModel };
|
|
21
20
|
//# sourceMappingURL=neon-chat-language-model.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { applyNeonCapabilities, mergeStreamStartWarnings } from "./neon-capabilities.js";
|
|
2
2
|
import { OpenAICompatibleChatLanguageModel } from "@ai-sdk/openai-compatible";
|
|
3
|
-
|
|
3
|
+
// src/lib/neon-chat-language-model.ts
|
|
4
4
|
/**
|
|
5
5
|
* Language model for the Neon AI Gateway unified (MLflow) endpoint.
|
|
6
6
|
*
|
|
@@ -28,7 +28,6 @@ var NeonChatLanguageModel = class extends OpenAICompatibleChatLanguageModel {
|
|
|
28
28
|
} : result;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
//#endregion
|
|
32
31
|
export { NeonChatLanguageModel };
|
|
33
32
|
|
|
34
33
|
//# sourceMappingURL=neon-chat-language-model.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
//#region src/lib/neon-chat-options.d.ts
|
|
2
1
|
/** Published catalog ids from https://neon.com/models.json (canonical, unprefixed). */
|
|
3
|
-
declare const NEON_MODELS_DEV_IDS: readonly ["claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5", "claude-haiku-5-5", "claude-opus-4-1", "claude-opus-4-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8", "claude-opus-5", "claude-opus-5-5", "claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-5", "claude-sonnet-5-5", "gpt-5", "gpt-5-1", "gpt-5-2", "gpt-5-3-codex", "gpt-5-4", "gpt-5-4-mini", "gpt-5-4-nano", "gpt-5-5", "gpt-5-5-pro", "gpt-5-6-luna", "gpt-5-6-sol", "gpt-5-6-terra", "gpt-5-mini", "gpt-5-nano", "gpt-6-1-sol", "gpt-6-astra", "gpt-6-luna", "gpt-6-sol", "gpt-oss-120b", "gpt-oss-20b", "gemini-3-1-flash-lite", "gemini-3-1-pro", "gemini-3-5-flash", "gemini-3-5-flash-lite", "gemini-3-6-flash", "gemini-3-7-flash", "gemini-3-8-flash", "gemini-3-flash", "gemini-4-argon", "gemma-3-12b", "llama-4-maverick", "meta-llama-3-1-8b-instruct", "meta-llama-3-3-70b-instruct", "qwen3-next-80b-a3b-instruct", "qwen35-122b-a10b", "glm-5-2", "glm-5-3", "glm-5-3-flash", "grok-4-6", "grok-4-7", "
|
|
2
|
+
declare const NEON_MODELS_DEV_IDS: readonly ["claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5", "claude-haiku-5-5", "claude-opus-4-1", "claude-opus-4-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8", "claude-opus-5", "claude-opus-5-5", "claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-5", "claude-sonnet-5-5", "gpt-5", "gpt-5-1", "gpt-5-2", "gpt-5-3-codex", "gpt-5-4", "gpt-5-4-mini", "gpt-5-4-nano", "gpt-5-5", "gpt-5-5-pro", "gpt-5-6-luna", "gpt-5-6-sol", "gpt-5-6-terra", "gpt-5-mini", "gpt-5-nano", "gpt-6-1-sol", "gpt-6-astra", "gpt-6-luna", "gpt-6-sol", "gpt-oss-120b", "gpt-oss-20b", "gemini-3-1-flash-lite", "gemini-3-1-pro", "gemini-3-5-flash", "gemini-3-5-flash-lite", "gemini-3-6-flash", "gemini-3-7-flash", "gemini-3-8-flash", "gemini-3-flash", "gemini-4-argon", "gemma-3-12b", "llama-4-maverick", "meta-llama-3-1-8b-instruct", "meta-llama-3-3-70b-instruct", "qwen3-next-80b-a3b-instruct", "qwen35-122b-a10b", "glm-5-2", "glm-5-3", "glm-5-3-flash", "grok-4-6", "grok-4-7", "kimi-k3", "deepseek-v4-1-flash"];
|
|
4
3
|
/** A known Neon AI Gateway model id. */
|
|
5
4
|
type NeonKnownModelId = (typeof NEON_MODELS_DEV_IDS)[number];
|
|
6
5
|
/**
|
|
@@ -9,6 +8,5 @@ type NeonKnownModelId = (typeof NEON_MODELS_DEV_IDS)[number];
|
|
|
9
8
|
* accepted via the `(string & {})` fallback.
|
|
10
9
|
*/
|
|
11
10
|
type NeonChatModelId = NeonKnownModelId | (string & {});
|
|
12
|
-
//#endregion
|
|
13
11
|
export { NEON_MODELS_DEV_IDS, NeonChatModelId, NeonKnownModelId };
|
|
14
12
|
//# sourceMappingURL=neon-chat-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neon-chat-options.d.ts","names":["NEON_MODELS_DEV_IDS","NeonKnownModelId","NeonChatModelId","NEON_MODELS_DEV_IDS","NeonKnownModelId","NeonChatModelId"],"sources":["../../src/lib/neon-chat-options.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"neon-chat-options.d.ts","names":["NEON_MODELS_DEV_IDS","NeonKnownModelId","NeonChatModelId","NEON_MODELS_DEV_IDS","NeonKnownModelId","NeonChatModelId"],"sources":["../../src/lib/neon-chat-options.ts"],"mappings":";AAiBaA,cAAAA,mBAoEH,EAAA,SAAA,CAAA,gBAAA,EAAA,kBAAA,EAAA,kBAAA,EAAA,kBAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,iBAAA,EAAA,mBAAA,EAAA,mBAAA,EAAA,iBAAA,EAAA,mBAAA,EAAA,OAAA,EAAA,SAAA,EAAA,SAAA,EAAA,eAAA,EAAA,SAAA,EAAA,cAAA,EAAA,cAAA,EAAA,SAAA,EAAA,aAAA,EAAA,cAAA,EAAA,aAAA,EAAA,eAAA,EAAA,YAAA,EAAA,YAAA,EAAA,aAAA,EAAA,aAAA,EAAA,YAAA,EAAA,WAAA,EAAA,cAAA,EAAA,aAAA,EAAA,uBAAA,EAAA,gBAAA,EAAA,kBAAA,EAAA,uBAAA,EAAA,kBAAA,EAAA,kBAAA,EAAA,kBAAA,EAAA,gBAAA,EAAA,gBAAA,EAAA,aAAA,EAAA,kBAAA,EAAA,4BAAA,EAAA,6BAAA,EAAA,6BAAA,EAAA,kBAAA,EAAA,SAAA,EAAA,SAAA,EAAA,eAAA,EAAA,UAAA,EAAA,UAAA,EAAA,SAAA,EAAA,qBAAA,CAAA;AAGV;AAOYE,KAPAD,gBAAAA,GAOe,CAAGA,OAPSD,mBAOO,CAAA,CAAA,MAAA,CAAA;;;;;;A,KAAlCE,eAAAA,GAAkBD,gB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/neon-chat-options.ts
|
|
2
2
|
/** Published catalog ids from https://neon.com/models.json (canonical, unprefixed). */
|
|
3
3
|
const NEON_MODELS_DEV_IDS = [
|
|
4
4
|
"claude-fable-5",
|
|
@@ -56,11 +56,9 @@ const NEON_MODELS_DEV_IDS = [
|
|
|
56
56
|
"glm-5-3-flash",
|
|
57
57
|
"grok-4-6",
|
|
58
58
|
"grok-4-7",
|
|
59
|
-
"inkling",
|
|
60
59
|
"kimi-k3",
|
|
61
60
|
"deepseek-v4-1-flash"
|
|
62
61
|
];
|
|
63
|
-
//#endregion
|
|
64
62
|
export { NEON_MODELS_DEV_IDS };
|
|
65
63
|
|
|
66
64
|
//# sourceMappingURL=neon-chat-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neon-chat-options.js","names":[],"sources":["../../src/lib/neon-chat-options.ts"],"sourcesContent":["// Models served by the Neon AI Gateway. Anthropic and OpenAI models are routed\n// to their provider-native endpoints; everything else uses the unified MLflow\n// (OpenAI-compatible) endpoint.\n//\n// Ids use the canonical Neon (unprefixed) form, matching\n// https://neon.com/models.json. The gateway also accepts the legacy\n// `databricks-` prefixed form, which still resolves via the `(string & {})`\n// fallback on `NeonChatModelId`.\n//\n// `NEON_MODELS_DEV_IDS` mirrors the `released: true` chat entries of\n// neon.com/models.json `neon.models` exactly — `neon-catalog-drift.test.ts`\n// fails if the two diverge. A branch's live list\n// is `GET $NEON_AI_GATEWAY_BASE_URL/v1/models`. There is deliberately no second\n// list for ids the gateway serves ahead of the published catalog: such an id\n// already works because `NeonChatModelId` accepts any string.\n\n/** Published catalog ids from https://neon.com/models.json (canonical, unprefixed). */\nexport const NEON_MODELS_DEV_IDS = [\n\t// Anthropic (native Messages API)\n\t\"claude-fable-5\",\n\t\"claude-fable-5-1\",\n\t\"claude-haiku-4-5\",\n\t\"claude-haiku-5-5\",\n\t\"claude-opus-4-1\",\n\t\"claude-opus-4-5\",\n\t\"claude-opus-4-6\",\n\t\"claude-opus-4-7\",\n\t\"claude-opus-4-8\",\n\t\"claude-opus-5\",\n\t\"claude-opus-5-5\",\n\t\"claude-sonnet-4-5\",\n\t\"claude-sonnet-4-6\",\n\t\"claude-sonnet-5\",\n\t\"claude-sonnet-5-5\",\n\t// OpenAI (native Responses API)\n\t\"gpt-5\",\n\t\"gpt-5-1\",\n\t\"gpt-5-2\",\n\t\"gpt-5-3-codex\",\n\t\"gpt-5-4\",\n\t\"gpt-5-4-mini\",\n\t\"gpt-5-4-nano\",\n\t\"gpt-5-5\",\n\t\"gpt-5-5-pro\",\n\t\"gpt-5-6-luna\",\n\t\"gpt-5-6-sol\",\n\t\"gpt-5-6-terra\",\n\t\"gpt-5-mini\",\n\t\"gpt-5-nano\",\n\t\"gpt-6-1-sol\",\n\t\"gpt-6-astra\",\n\t\"gpt-6-luna\",\n\t\"gpt-6-sol\",\n\t// OpenAI open-weight (unified MLflow endpoint)\n\t\"gpt-oss-120b\",\n\t\"gpt-oss-20b\",\n\t// Google (unified MLflow endpoint)\n\t\"gemini-3-1-flash-lite\",\n\t\"gemini-3-1-pro\",\n\t\"gemini-3-5-flash\",\n\t\"gemini-3-5-flash-lite\",\n\t\"gemini-3-6-flash\",\n\t\"gemini-3-7-flash\",\n\t\"gemini-3-8-flash\",\n\t\"gemini-3-flash\",\n\t\"gemini-4-argon\",\n\t\"gemma-3-12b\",\n\t// Meta (unified MLflow endpoint)\n\t\"llama-4-maverick\",\n\t\"meta-llama-3-1-8b-instruct\",\n\t\"meta-llama-3-3-70b-instruct\",\n\t// Alibaba (unified MLflow endpoint)\n\t\"qwen3-next-80b-a3b-instruct\",\n\t\"qwen35-122b-a10b\",\n\t// Zhipu (unified MLflow endpoint)\n\t\"glm-5-2\",\n\t\"glm-5-3\",\n\t\"glm-5-3-flash\",\n\t// xAI (unified MLflow endpoint)\n\t\"grok-4-6\",\n\t\"grok-4-7\",\n\t//
|
|
1
|
+
{"version":3,"file":"neon-chat-options.js","names":[],"sources":["../../src/lib/neon-chat-options.ts"],"sourcesContent":["// Models served by the Neon AI Gateway. Anthropic and OpenAI models are routed\n// to their provider-native endpoints; everything else uses the unified MLflow\n// (OpenAI-compatible) endpoint.\n//\n// Ids use the canonical Neon (unprefixed) form, matching\n// https://neon.com/models.json. The gateway also accepts the legacy\n// `databricks-` prefixed form, which still resolves via the `(string & {})`\n// fallback on `NeonChatModelId`.\n//\n// `NEON_MODELS_DEV_IDS` mirrors the `released: true` chat entries of\n// neon.com/models.json `neon.models` exactly — `neon-catalog-drift.test.ts`\n// fails if the two diverge. A branch's live list\n// is `GET $NEON_AI_GATEWAY_BASE_URL/v1/models`. There is deliberately no second\n// list for ids the gateway serves ahead of the published catalog: such an id\n// already works because `NeonChatModelId` accepts any string.\n\n/** Published catalog ids from https://neon.com/models.json (canonical, unprefixed). */\nexport const NEON_MODELS_DEV_IDS = [\n\t// Anthropic (native Messages API)\n\t\"claude-fable-5\",\n\t\"claude-fable-5-1\",\n\t\"claude-haiku-4-5\",\n\t\"claude-haiku-5-5\",\n\t\"claude-opus-4-1\",\n\t\"claude-opus-4-5\",\n\t\"claude-opus-4-6\",\n\t\"claude-opus-4-7\",\n\t\"claude-opus-4-8\",\n\t\"claude-opus-5\",\n\t\"claude-opus-5-5\",\n\t\"claude-sonnet-4-5\",\n\t\"claude-sonnet-4-6\",\n\t\"claude-sonnet-5\",\n\t\"claude-sonnet-5-5\",\n\t// OpenAI (native Responses API)\n\t\"gpt-5\",\n\t\"gpt-5-1\",\n\t\"gpt-5-2\",\n\t\"gpt-5-3-codex\",\n\t\"gpt-5-4\",\n\t\"gpt-5-4-mini\",\n\t\"gpt-5-4-nano\",\n\t\"gpt-5-5\",\n\t\"gpt-5-5-pro\",\n\t\"gpt-5-6-luna\",\n\t\"gpt-5-6-sol\",\n\t\"gpt-5-6-terra\",\n\t\"gpt-5-mini\",\n\t\"gpt-5-nano\",\n\t\"gpt-6-1-sol\",\n\t\"gpt-6-astra\",\n\t\"gpt-6-luna\",\n\t\"gpt-6-sol\",\n\t// OpenAI open-weight (unified MLflow endpoint)\n\t\"gpt-oss-120b\",\n\t\"gpt-oss-20b\",\n\t// Google (unified MLflow endpoint)\n\t\"gemini-3-1-flash-lite\",\n\t\"gemini-3-1-pro\",\n\t\"gemini-3-5-flash\",\n\t\"gemini-3-5-flash-lite\",\n\t\"gemini-3-6-flash\",\n\t\"gemini-3-7-flash\",\n\t\"gemini-3-8-flash\",\n\t\"gemini-3-flash\",\n\t\"gemini-4-argon\",\n\t\"gemma-3-12b\",\n\t// Meta (unified MLflow endpoint)\n\t\"llama-4-maverick\",\n\t\"meta-llama-3-1-8b-instruct\",\n\t\"meta-llama-3-3-70b-instruct\",\n\t// Alibaba (unified MLflow endpoint)\n\t\"qwen3-next-80b-a3b-instruct\",\n\t\"qwen35-122b-a10b\",\n\t// Zhipu (unified MLflow endpoint)\n\t\"glm-5-2\",\n\t\"glm-5-3\",\n\t\"glm-5-3-flash\",\n\t// xAI (unified MLflow endpoint)\n\t\"grok-4-6\",\n\t\"grok-4-7\",\n\t// Moonshot (unified MLflow endpoint)\n\t\"kimi-k3\",\n\t// DeepSeek (unified MLflow endpoint)\n\t\"deepseek-v4-1-flash\",\n] as const;\n\n/** A known Neon AI Gateway model id. */\nexport type NeonKnownModelId = (typeof NEON_MODELS_DEV_IDS)[number];\n\n/**\n * A Neon AI Gateway model id. Known ids are listed for autocomplete; any other\n * id (e.g. a brand-new model, or the legacy `databricks-` prefixed form) is\n * accepted via the `(string & {})` fallback.\n */\nexport type NeonChatModelId = NeonKnownModelId | (string & {});\n"],"mappings":";;AAiBA,MAAa,sBAAsB;CAElC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CAEA;CACA;CAEA;CAEA;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APICallError, SharedV3Headers, SharedV3ProviderMetadata, SharedV3Warning } from "@ai-sdk/provider";
|
|
2
2
|
import { FetchFunction, ResponseHandler } from "@ai-sdk/provider-utils";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/neon-decision-model.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A System One decision model id, such as `typesafeai-jev-1-14-0`. Any string is
|
|
@@ -97,6 +97,5 @@ declare class NeonDecisionModel {
|
|
|
97
97
|
headers
|
|
98
98
|
}: NeonDecisionCallOptions): Promise<NeonDecisionResult>;
|
|
99
99
|
}
|
|
100
|
-
//#endregion
|
|
101
100
|
export { NeonDecisionAnswer, NeonDecisionCallOptions, NeonDecisionModel, NeonDecisionModelConfig, NeonDecisionModelId, NeonDecisionQuestion, NeonDecisionResult };
|
|
102
101
|
//# sourceMappingURL=neon-decision-model.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UnsupportedFunctionalityError } from "@ai-sdk/provider";
|
|
2
2
|
import { combineHeaders, createJsonResponseHandler, postJsonToApi } from "@ai-sdk/provider-utils";
|
|
3
3
|
import { z } from "zod/v4";
|
|
4
|
-
|
|
4
|
+
// src/lib/neon-decision-model.ts
|
|
5
5
|
const systemOneResponseSchema = z.object({
|
|
6
6
|
model: z.string().nullish(),
|
|
7
7
|
answers: z.record(z.string(), z.discriminatedUnion("type", [
|
|
@@ -110,7 +110,6 @@ function toDecisionAnswer(answer) {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
//#endregion
|
|
114
113
|
export { NeonDecisionModel };
|
|
115
114
|
|
|
116
115
|
//# sourceMappingURL=neon-decision-model.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/lib/neon-embedding-options.d.ts
|
|
2
1
|
/** Published embedding model ids from https://neon.com/models.json. */
|
|
3
2
|
declare const NEON_EMBEDDING_MODEL_IDS: readonly ["bge-large-en", "gte-large-en", "qwen3-embedding-0-6b"];
|
|
4
3
|
/**
|
|
@@ -8,6 +7,5 @@ declare const NEON_EMBEDDING_MODEL_IDS: readonly ["bge-large-en", "gte-large-en"
|
|
|
8
7
|
type NeonEmbeddingModelId = (typeof NEON_EMBEDDING_MODEL_IDS)[number] | (string & {});
|
|
9
8
|
/** The gateway rejects an embeddings request with more inputs than this. */
|
|
10
9
|
declare const NEON_MAX_EMBEDDINGS_PER_CALL = 150;
|
|
11
|
-
//#endregion
|
|
12
10
|
export { NEON_EMBEDDING_MODEL_IDS, NEON_MAX_EMBEDDINGS_PER_CALL, NeonEmbeddingModelId };
|
|
13
11
|
//# sourceMappingURL=neon-embedding-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neon-embedding-options.d.ts","names":["NEON_EMBEDDING_MODEL_IDS","NeonEmbeddingModelId","NEON_MAX_EMBEDDINGS_PER_CALL","NEON_EMBEDDING_MODEL_IDS","NeonEmbeddingModelId","NEON_MAX_EMBEDDINGS_PER_CALL"],"sources":["../../src/lib/neon-embedding-options.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"neon-embedding-options.d.ts","names":["NEON_EMBEDDING_MODEL_IDS","NeonEmbeddingModelId","NEON_MAX_EMBEDDINGS_PER_CALL","NEON_EMBEDDING_MODEL_IDS","NeonEmbeddingModelId","NEON_MAX_EMBEDDINGS_PER_CALL"],"sources":["../../src/lib/neon-embedding-options.ts"],"mappings":";AAMaA,cAAAA,wBAIH,EAAA,SAAA,CAAA,cAAA,EAAA,cAAA,EAAA,sBAAA,CAAA;AAMV;AAKA;;;A,KALYC,oBAAAA,G,QACDD,wB;;A,cAIEE,4BAAAA,G"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/neon-embedding-options.ts
|
|
2
2
|
/** Published embedding model ids from https://neon.com/models.json. */
|
|
3
3
|
const NEON_EMBEDDING_MODEL_IDS = [
|
|
4
4
|
"bge-large-en",
|
|
@@ -7,7 +7,6 @@ const NEON_EMBEDDING_MODEL_IDS = [
|
|
|
7
7
|
];
|
|
8
8
|
/** The gateway rejects an embeddings request with more inputs than this. */
|
|
9
9
|
const NEON_MAX_EMBEDDINGS_PER_CALL = 150;
|
|
10
|
-
//#endregion
|
|
11
10
|
export { NEON_EMBEDDING_MODEL_IDS, NEON_MAX_EMBEDDINGS_PER_CALL };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=neon-embedding-options.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/lib/neon-gateway-error.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Give every route of this provider the error envelope its model knows how to
|
|
@@ -51,6 +51,5 @@ type GatewayErrorDialect = "openai" | "anthropic";
|
|
|
51
51
|
declare function normalizeGatewayErrorBody(body: unknown, dialect: GatewayErrorDialect): unknown | null;
|
|
52
52
|
/** Wrap a fetch so failed responses reach the model in its own dialect. */
|
|
53
53
|
declare function wrapFetchWithGatewayErrorNormalization(baseFetch: FetchFunction | undefined, dialect: GatewayErrorDialect): FetchFunction;
|
|
54
|
-
//#endregion
|
|
55
54
|
export { GatewayErrorDialect, normalizeGatewayErrorBody, wrapFetchWithGatewayErrorNormalization };
|
|
56
55
|
//# sourceMappingURL=neon-gateway-error.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/neon-gateway-error.ts
|
|
2
2
|
function isRecord(value) {
|
|
3
3
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
4
|
}
|
|
@@ -96,7 +96,6 @@ function wrapFetchWithGatewayErrorNormalization(baseFetch, dialect) {
|
|
|
96
96
|
});
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
//#endregion
|
|
100
99
|
export { normalizeGatewayErrorBody, wrapFetchWithGatewayErrorNormalization };
|
|
101
100
|
|
|
102
101
|
//# sourceMappingURL=neon-gateway-error.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/lib/neon-harmony-normalize.d.ts
|
|
4
4
|
interface ExtractedHarmony {
|
|
5
5
|
text: string;
|
|
6
6
|
reasoning: string;
|
|
@@ -36,6 +36,5 @@ declare function normalizeChunkBody(body: unknown): NormalizeResult;
|
|
|
36
36
|
* gateway is fixed.
|
|
37
37
|
*/
|
|
38
38
|
declare function wrapFetchWithHarmonyNormalization(baseFetch?: FetchFunction): FetchFunction;
|
|
39
|
-
//#endregion
|
|
40
39
|
export { extractHarmonyContent, normalizeChunkBody, normalizeCompletionBody, wrapFetchWithHarmonyNormalization };
|
|
41
40
|
//# sourceMappingURL=neon-harmony-normalize.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/neon-harmony-normalize.ts
|
|
2
2
|
/**
|
|
3
3
|
* Normalize the Neon AI Gateway's non-OpenAI-compliant `gpt-oss` ("harmony")
|
|
4
4
|
* response shape into the OpenAI Chat Completions contract before it reaches
|
|
@@ -192,7 +192,6 @@ function wrapFetchWithHarmonyNormalization(baseFetch) {
|
|
|
192
192
|
return response;
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
//#endregion
|
|
196
195
|
export { extractHarmonyContent, normalizeChunkBody, normalizeCompletionBody, wrapFetchWithHarmonyNormalization };
|
|
197
196
|
|
|
198
197
|
//# sourceMappingURL=neon-harmony-normalize.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/lib/neon-model-capabilities.d.ts
|
|
2
1
|
type NeonModelFamily = "anthropic" | "google" | "openai" | "meta" | "other";
|
|
3
2
|
/**
|
|
4
3
|
* Which gateway endpoint a model should be routed to.
|
|
@@ -43,6 +42,5 @@ interface NeonModelCapabilities {
|
|
|
43
42
|
* instead. Unknown/untested models stay permissive (passed through unchanged).
|
|
44
43
|
*/
|
|
45
44
|
declare function getNeonModelCapabilities(modelId: string): NeonModelCapabilities;
|
|
46
|
-
//#endregion
|
|
47
45
|
export { NeonModelCapabilities, NeonModelFamily, NeonModelRoute, getNeonModelCapabilities, getNeonModelRoute };
|
|
48
46
|
//# sourceMappingURL=neon-model-capabilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neon-model-capabilities.d.ts","names":["NeonModelFamily","NeonModelRoute","getNeonModelRoute","NeonModelCapabilities","getNeonModelCapabilities","NeonModelFamily","NeonModelRoute","getNeonModelRoute","modelId","NeonModelCapabilities","family","supportsTemperature","supportsTopP","temperatureTopPMutuallyExclusive","supportsPenalties","supportsSeed","supportsStopSequences","supportsReasoningEffort","claudeSamplingUnrecognized","getNeonModelCapabilities"],"sources":["../../src/lib/neon-model-capabilities.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"neon-model-capabilities.d.ts","names":["NeonModelFamily","NeonModelRoute","getNeonModelRoute","NeonModelCapabilities","getNeonModelCapabilities","NeonModelFamily","NeonModelRoute","getNeonModelRoute","modelId","NeonModelCapabilities","family","supportsTemperature","supportsTopP","temperatureTopPMutuallyExclusive","supportsPenalties","supportsSeed","supportsStopSequences","supportsReasoningEffort","claudeSamplingUnrecognized","getNeonModelCapabilities"],"sources":["../../src/lib/neon-model-capabilities.ts"],"mappings":"A,KAAYA,eAAAA,G;AAAZ;AAiBA;AAEA;AAiBA;AAoIA;;;;;;A,KAvJYC,cAAAA,G;A,iBAEIC,iBAAAA,C,kBAAoCD,c;A,UAiBnCE,qBAAAA,C;E,QACRH,e;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A,iBAmIOI,wBAAAA,C,kBAEbD,qB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/neon-model-capabilities.ts
|
|
2
2
|
function getNeonModelRoute(modelId) {
|
|
3
3
|
const id = modelId.toLowerCase();
|
|
4
4
|
if (id.includes("claude")) return "anthropic";
|
|
@@ -176,7 +176,7 @@ function getNeonModelCapabilities(modelId) {
|
|
|
176
176
|
supportsPenalties: false,
|
|
177
177
|
supportsSeed: false
|
|
178
178
|
};
|
|
179
|
-
if (id.includes("glm") || id.includes("
|
|
179
|
+
if (id.includes("glm") || id.includes("kimi") || id.includes("grok") || id.includes("deepseek")) return {
|
|
180
180
|
family: "other",
|
|
181
181
|
...PERMISSIVE,
|
|
182
182
|
supportsPenalties: false
|
|
@@ -186,7 +186,6 @@ function getNeonModelCapabilities(modelId) {
|
|
|
186
186
|
...PERMISSIVE
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
//#endregion
|
|
190
189
|
export { getNeonModelCapabilities, getNeonModelRoute };
|
|
191
190
|
|
|
192
191
|
//# sourceMappingURL=neon-model-capabilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neon-model-capabilities.js","names":[],"sources":["../../src/lib/neon-model-capabilities.ts"],"sourcesContent":["export type NeonModelFamily =\n\t| \"anthropic\"\n\t| \"google\"\n\t| \"openai\"\n\t| \"meta\"\n\t| \"other\";\n\n/**\n * Which gateway endpoint a model should be routed to.\n *\n * - `anthropic`: native Messages API — streaming structured output + native reasoning.\n * - `openai`: native Responses API — models served only natively (e.g. Codex),\n * native reasoning, and the image-generation tool.\n * - `mlflow`: the unified, OpenAI-compatible endpoint (the fallback). Gemini is\n * routed here because the gateway's native Gemini endpoint does not support\n * streaming (`streamGenerateContent` is rejected).\n */\nexport type NeonModelRoute = \"anthropic\" | \"openai\" | \"mlflow\";\n\nexport function getNeonModelRoute(modelId: string): NeonModelRoute {\n\tconst id = modelId.toLowerCase();\n\tif (id.includes(\"claude\")) {\n\t\treturn \"anthropic\";\n\t}\n\t// OpenAI proprietary models (gpt-4/gpt-5 families, Codex) are served only via\n\t// the native Responses API. `gpt-oss` is open-weight and served on the\n\t// unified chat endpoint, so it is intentionally excluded here.\n\tif (\n\t\t(id.includes(\"gpt-\") && !id.includes(\"gpt-oss\")) ||\n\t\tid.includes(\"codex\")\n\t) {\n\t\treturn \"openai\";\n\t}\n\treturn \"mlflow\";\n}\n\nexport interface NeonModelCapabilities {\n\tfamily: NeonModelFamily;\n\tsupportsTemperature: boolean;\n\tsupportsTopP: boolean;\n\t/**\n\t * Whether `temperature` and `topP` may be sent together. Anthropic models\n\t * accept only one of the two.\n\t */\n\ttemperatureTopPMutuallyExclusive: boolean;\n\tsupportsPenalties: boolean;\n\tsupportsSeed: boolean;\n\tsupportsStopSequences: boolean;\n\tsupportsReasoningEffort: boolean;\n\t/**\n\t * True when a `claude-*` id could not be parsed into a version and was\n\t * assumed to be new. The sampling restriction is then a precaution rather\n\t * than something measured, and the warning says so instead of asserting a\n\t * capability nobody checked.\n\t */\n\tclaudeSamplingUnrecognized?: boolean;\n}\n\n/**\n * Gemini models the gateway rejects penalties on, by measurement. Their older\n * siblings accept them, so this cannot be derived from the id.\n *\n * Matched exactly rather than by substring: `gemini-3-6-flash` is a prefix of\n * any `gemini-3-6-flash-*` id Google may ship next, and inheriting a measured\n * restriction on the strength of a shared prefix is how the Gemini rule was\n * wrong for these two in the first place.\n */\nconst GEMINI_NO_PENALTIES = new Set([\n\t\"gemini-3-5-flash-lite\",\n\t\"gemini-3-6-flash\",\n\t\"gemini-3-7-flash\",\n\t\"gemini-3-8-flash\",\n\t\"gemini-4-argon\",\n]);\n\n/** Gemini models that reject `temperature` and `topP` outright. */\nconst GEMINI_NO_SAMPLING = new Set([\n\t\"gemini-3-6-flash\",\n\t\"gemini-3-7-flash\",\n\t\"gemini-3-8-flash\",\n\t\"gemini-4-argon\",\n]);\n\n/**\n * GPT-5 ids that reject `temperature` despite carrying a minor version.\n *\n * The version rule below reads `gpt-5-5-pro` as 5.5 and concludes it takes\n * sampling parameters. It does not — the Responses API answers\n * `Unsupported parameter: temperature`. Measured the same for `top_p`, and for\n * gpt-5.5 and the gpt-5.6 family at their default reasoning effort.\n *\n * The Responses API accepts `temperature` and `top_p` only when reasoning effort\n * is `none`, so these values describe each model's default effort. gpt-5.1\n * through gpt-5.4 default to `none` and accept both; with effort `low` they\n * reject them too. gpt-5.5 and gpt-5.6 accept both when effort is `none`.\n */\nconst GPT5_NO_SAMPLING = new Set([\n\t\"gpt-5-5\",\n\t\"gpt-5-5-pro\",\n\t\"gpt-5-6-luna\",\n\t\"gpt-5-6-sol\",\n\t\"gpt-5-6-terra\",\n]);\n\n/**\n * GPT-6 ids that reject `temperature` and `top_p` on the Responses API at their\n * default reasoning effort\n * (`Unsupported parameter: 'temperature' is not supported with this model`).\n * gpt-6-sol and gpt-6-luna accept both when effort is `none`; gpt-6-astra and\n * gpt-6-1-sol reject effort `none`, so they never accept them.\n * Exact ids: a future gpt-6-* is unmeasured.\n */\nconst GPT6_NO_SAMPLING = new Set([\n\t\"gpt-6-1-sol\",\n\t\"gpt-6-astra\",\n\t\"gpt-6-luna\",\n\t\"gpt-6-sol\",\n]);\n\n/**\n * The gateway accepts an optional `databricks-` prefix on any id, so strip it\n * before an exact-match lookup. Prefix rules elsewhere in this file tolerate it\n * incidentally; exact matches do not.\n */\nfunction canonicalId(id: string): string {\n\treturn id.startsWith(\"databricks-\") ? id.slice(\"databricks-\".length) : id;\n}\n\nconst PERMISSIVE: Omit<NeonModelCapabilities, \"family\"> = {\n\tsupportsTemperature: true,\n\tsupportsTopP: true,\n\ttemperatureTopPMutuallyExclusive: false,\n\tsupportsPenalties: true,\n\tsupportsSeed: true,\n\tsupportsStopSequences: true,\n\tsupportsReasoningEffort: true,\n};\n\n/**\n * Whether a Claude id predates the 4.7 cutoff where the gateway stopped\n * accepting `temperature` and `top_p`. Ids look like `claude-<tier>-<major>` or\n * `claude-<tier>-<major>-<minor>`, optionally behind the legacy `databricks-`\n * prefix. An id we cannot parse is treated as new, which is the safe direction.\n */\nfunction claudeVersion(id: string): { major: number; minor: number } | null {\n\t// Anchored: `claude-opus-4-beta` and `claude-opus-4.7` must not match their\n\t// leading digits and be read as old models. A dated id such as\n\t// `claude-3-5-sonnet-20241022` does not parse either, and is reported as\n\t// unrecognised rather than silently classified.\n\tconst match = /^(?:databricks-)?claude-[a-z]+-(\\d+)(?:-(\\d+))?$/.exec(id);\n\tif (!match) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tmajor: Number(match[1]),\n\t\tminor: match[2] === undefined ? 0 : Number(match[2]),\n\t};\n}\n\n/**\n * Heuristic, prefix-based capability detection for MLflow-routed Neon models.\n *\n * The unified endpoint proxies to heterogeneous upstream providers, each of\n * which accepts a different subset of the OpenAI-style parameters the AI SDK\n * emits. Sending a parameter an upstream rejects results in a hard `400`, so we\n * strip the parameters a family is known to reject and surface a warning\n * instead. Unknown/untested models stay permissive (passed through unchanged).\n */\nexport function getNeonModelCapabilities(\n\tmodelId: string,\n): NeonModelCapabilities {\n\tconst id = modelId.toLowerCase();\n\n\t// Anthropic (Claude): rejects penalties and seed, accepts only one of\n\t// temperature/topP, and rejects the OpenAI `reasoning_effort` field.\n\t//\n\t// From Claude 4.7 onward the gateway also rejects non-default sampling\n\t// entirely — `does not support the temperature parameter` /\n\t// `does not support sampling parameters: top_p` — because those models are\n\t// steered with `output_config.effort` instead. Measured: 4.1/4.5/4.6 accept\n\t// both, 4.7/4.8/5 reject both, and every id accepts the default\n\t// `temperature: 1.0`. A version comparison rather than a list of ids, so a\n\t// future Claude inherits the restriction: dropping a parameter the model\n\t// would have accepted costs a warning, claiming one it rejects costs a 400.\n\tif (id.includes(\"claude\")) {\n\t\tconst version = claudeVersion(id);\n\t\tconst sampling =\n\t\t\tversion !== null &&\n\t\t\t(version.major < 4 || (version.major === 4 && version.minor <= 6));\n\t\treturn {\n\t\t\tfamily: \"anthropic\",\n\t\t\tsupportsTemperature: sampling,\n\t\t\tsupportsTopP: sampling,\n\t\t\ttemperatureTopPMutuallyExclusive: true,\n\t\t\tsupportsPenalties: false,\n\t\t\tsupportsSeed: false,\n\t\t\tsupportsStopSequences: true,\n\t\t\tsupportsReasoningEffort: false,\n\t\t\t...(version === null ? { claudeSamplingUnrecognized: true } : {}),\n\t\t};\n\t}\n\n\t// Google (Gemini): accepts standard sampling params, and does take\n\t// `reasoning_effort` — the gateway maps it onto Gemini's thinking config.\n\t// Measured on gemini-3-6-flash: `minimal` produces 0 reasoning tokens and\n\t// `high` produces 310, against 130 with the field absent.\n\t//\n\t// Newer Gemini models are stricter, and not in a way the id predicts: the\n\t// gateway rejects penalties on `gemini-3-5-flash-lite` while accepting them\n\t// on `gemini-3-1-flash-lite`, so neither the version nor the `-lite` suffix\n\t// is the rule. The `GEMINI_NO_SAMPLING` ids refuse temperature and topP\n\t// outright (\"does not support the temperature parameter\"). Both sets above\n\t// are listed by id because that is what was measured; a new Gemini model\n\t// inherits the permissive default until someone measures it.\n\tif (id.includes(\"gemini\")) {\n\t\tconst canonical = canonicalId(id);\n\t\tconst acceptsSampling = !GEMINI_NO_SAMPLING.has(canonical);\n\t\treturn {\n\t\t\tfamily: \"google\",\n\t\t\t...PERMISSIVE,\n\t\t\tsupportsTemperature: acceptsSampling,\n\t\t\tsupportsTopP: acceptsSampling,\n\t\t\tsupportsPenalties: !GEMINI_NO_PENALTIES.has(canonical),\n\t\t};\n\t}\n\n\t// OpenAI GPT-5 reasoning family (routed to the native Responses API). The\n\t// Responses model strips parameters the Responses API doesn't accept\n\t// (penalties, seed, stop), but its reasoning-model detection matches the bare\n\t// model id (`gpt-5`), which the gateway's optional `databricks-` prefix can\n\t// defeat. So we only handle the temperature/topP restriction here: the\n\t// original gpt-5 / gpt-5-mini / gpt-5-nano require the default temperature and\n\t// reject topP, while gpt-5.1+ (a minor version digit follows) accept them\n\t// again. The regex matches both prefixed and unprefixed ids.\n\tif (/gpt-5/.test(id)) {\n\t\tconst hasMinorVersion =\n\t\t\t/gpt-5[.-]\\d/.test(id) && !GPT5_NO_SAMPLING.has(canonicalId(id));\n\t\treturn {\n\t\t\tfamily: \"openai\",\n\t\t\tsupportsTemperature: hasMinorVersion,\n\t\t\tsupportsTopP: hasMinorVersion,\n\t\t\ttemperatureTopPMutuallyExclusive: false,\n\t\t\tsupportsPenalties: true,\n\t\t\tsupportsSeed: true,\n\t\t\tsupportsStopSequences: true,\n\t\t\tsupportsReasoningEffort: true,\n\t\t};\n\t}\n\n\t// The gpt-5 minor-version rule does not match gpt-6.\n\tif (GPT6_NO_SAMPLING.has(canonicalId(id))) {\n\t\treturn {\n\t\t\tfamily: \"openai\",\n\t\t\tsupportsTemperature: false,\n\t\t\tsupportsTopP: false,\n\t\t\ttemperatureTopPMutuallyExclusive: false,\n\t\t\tsupportsPenalties: true,\n\t\t\tsupportsSeed: true,\n\t\t\tsupportsStopSequences: true,\n\t\t\tsupportsReasoningEffort: true,\n\t\t};\n\t}\n\n\t// Meta (Llama): rejects penalties and seed; accepts sampling params and stop.\n\tif (id.includes(\"llama\")) {\n\t\treturn {\n\t\t\tfamily: \"meta\",\n\t\t\tsupportsTemperature: true,\n\t\t\tsupportsTopP: true,\n\t\t\ttemperatureTopPMutuallyExclusive: false,\n\t\t\tsupportsPenalties: false,\n\t\t\tsupportsSeed: false,\n\t\t\tsupportsStopSequences: true,\n\t\t\tsupportsReasoningEffort: true,\n\t\t};\n\t}\n\n\t// Everything else on the unified endpoint rejects penalties with\n\t// `parameter \"frequency_penalty\" must be equal to 0`. Only the older Gemini\n\t// models, handled above, accept them. Seed and stop vary, so each family\n\t// carries what was measured rather than inheriting a guess.\n\tif (id.includes(\"gpt-oss\")) {\n\t\treturn {\n\t\t\tfamily: \"other\",\n\t\t\t...PERMISSIVE,\n\t\t\tsupportsPenalties: false,\n\t\t\tsupportsSeed: false,\n\t\t\tsupportsStopSequences: false,\n\t\t};\n\t}\n\n\tif (id.includes(\"qwen\") || id.includes(\"gemma\")) {\n\t\treturn {\n\t\t\tfamily: \"other\",\n\t\t\t...PERMISSIVE,\n\t\t\tsupportsPenalties: false,\n\t\t\tsupportsSeed: false,\n\t\t};\n\t}\n\n\tif (\n\t\tid.includes(\"glm\") ||\n\t\tid.includes(\"inkling\") ||\n\t\tid.includes(\"kimi\") ||\n\t\tid.includes(\"grok\") ||\n\t\tid.includes(\"deepseek\")\n\t) {\n\t\treturn { family: \"other\", ...PERMISSIVE, supportsPenalties: false };\n\t}\n\n\treturn { family: \"other\", ...PERMISSIVE };\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"neon-model-capabilities.js","names":[],"sources":["../../src/lib/neon-model-capabilities.ts"],"sourcesContent":["export type NeonModelFamily =\n\t| \"anthropic\"\n\t| \"google\"\n\t| \"openai\"\n\t| \"meta\"\n\t| \"other\";\n\n/**\n * Which gateway endpoint a model should be routed to.\n *\n * - `anthropic`: native Messages API — streaming structured output + native reasoning.\n * - `openai`: native Responses API — models served only natively (e.g. Codex),\n * native reasoning, and the image-generation tool.\n * - `mlflow`: the unified, OpenAI-compatible endpoint (the fallback). Gemini is\n * routed here because the gateway's native Gemini endpoint does not support\n * streaming (`streamGenerateContent` is rejected).\n */\nexport type NeonModelRoute = \"anthropic\" | \"openai\" | \"mlflow\";\n\nexport function getNeonModelRoute(modelId: string): NeonModelRoute {\n\tconst id = modelId.toLowerCase();\n\tif (id.includes(\"claude\")) {\n\t\treturn \"anthropic\";\n\t}\n\t// OpenAI proprietary models (gpt-4/gpt-5 families, Codex) are served only via\n\t// the native Responses API. `gpt-oss` is open-weight and served on the\n\t// unified chat endpoint, so it is intentionally excluded here.\n\tif (\n\t\t(id.includes(\"gpt-\") && !id.includes(\"gpt-oss\")) ||\n\t\tid.includes(\"codex\")\n\t) {\n\t\treturn \"openai\";\n\t}\n\treturn \"mlflow\";\n}\n\nexport interface NeonModelCapabilities {\n\tfamily: NeonModelFamily;\n\tsupportsTemperature: boolean;\n\tsupportsTopP: boolean;\n\t/**\n\t * Whether `temperature` and `topP` may be sent together. Anthropic models\n\t * accept only one of the two.\n\t */\n\ttemperatureTopPMutuallyExclusive: boolean;\n\tsupportsPenalties: boolean;\n\tsupportsSeed: boolean;\n\tsupportsStopSequences: boolean;\n\tsupportsReasoningEffort: boolean;\n\t/**\n\t * True when a `claude-*` id could not be parsed into a version and was\n\t * assumed to be new. The sampling restriction is then a precaution rather\n\t * than something measured, and the warning says so instead of asserting a\n\t * capability nobody checked.\n\t */\n\tclaudeSamplingUnrecognized?: boolean;\n}\n\n/**\n * Gemini models the gateway rejects penalties on, by measurement. Their older\n * siblings accept them, so this cannot be derived from the id.\n *\n * Matched exactly rather than by substring: `gemini-3-6-flash` is a prefix of\n * any `gemini-3-6-flash-*` id Google may ship next, and inheriting a measured\n * restriction on the strength of a shared prefix is how the Gemini rule was\n * wrong for these two in the first place.\n */\nconst GEMINI_NO_PENALTIES = new Set([\n\t\"gemini-3-5-flash-lite\",\n\t\"gemini-3-6-flash\",\n\t\"gemini-3-7-flash\",\n\t\"gemini-3-8-flash\",\n\t\"gemini-4-argon\",\n]);\n\n/** Gemini models that reject `temperature` and `topP` outright. */\nconst GEMINI_NO_SAMPLING = new Set([\n\t\"gemini-3-6-flash\",\n\t\"gemini-3-7-flash\",\n\t\"gemini-3-8-flash\",\n\t\"gemini-4-argon\",\n]);\n\n/**\n * GPT-5 ids that reject `temperature` despite carrying a minor version.\n *\n * The version rule below reads `gpt-5-5-pro` as 5.5 and concludes it takes\n * sampling parameters. It does not — the Responses API answers\n * `Unsupported parameter: temperature`. Measured the same for `top_p`, and for\n * gpt-5.5 and the gpt-5.6 family at their default reasoning effort.\n *\n * The Responses API accepts `temperature` and `top_p` only when reasoning effort\n * is `none`, so these values describe each model's default effort. gpt-5.1\n * through gpt-5.4 default to `none` and accept both; with effort `low` they\n * reject them too. gpt-5.5 and gpt-5.6 accept both when effort is `none`.\n */\nconst GPT5_NO_SAMPLING = new Set([\n\t\"gpt-5-5\",\n\t\"gpt-5-5-pro\",\n\t\"gpt-5-6-luna\",\n\t\"gpt-5-6-sol\",\n\t\"gpt-5-6-terra\",\n]);\n\n/**\n * GPT-6 ids that reject `temperature` and `top_p` on the Responses API at their\n * default reasoning effort\n * (`Unsupported parameter: 'temperature' is not supported with this model`).\n * gpt-6-sol and gpt-6-luna accept both when effort is `none`; gpt-6-astra and\n * gpt-6-1-sol reject effort `none`, so they never accept them.\n * Exact ids: a future gpt-6-* is unmeasured.\n */\nconst GPT6_NO_SAMPLING = new Set([\n\t\"gpt-6-1-sol\",\n\t\"gpt-6-astra\",\n\t\"gpt-6-luna\",\n\t\"gpt-6-sol\",\n]);\n\n/**\n * The gateway accepts an optional `databricks-` prefix on any id, so strip it\n * before an exact-match lookup. Prefix rules elsewhere in this file tolerate it\n * incidentally; exact matches do not.\n */\nfunction canonicalId(id: string): string {\n\treturn id.startsWith(\"databricks-\") ? id.slice(\"databricks-\".length) : id;\n}\n\nconst PERMISSIVE: Omit<NeonModelCapabilities, \"family\"> = {\n\tsupportsTemperature: true,\n\tsupportsTopP: true,\n\ttemperatureTopPMutuallyExclusive: false,\n\tsupportsPenalties: true,\n\tsupportsSeed: true,\n\tsupportsStopSequences: true,\n\tsupportsReasoningEffort: true,\n};\n\n/**\n * Whether a Claude id predates the 4.7 cutoff where the gateway stopped\n * accepting `temperature` and `top_p`. Ids look like `claude-<tier>-<major>` or\n * `claude-<tier>-<major>-<minor>`, optionally behind the legacy `databricks-`\n * prefix. An id we cannot parse is treated as new, which is the safe direction.\n */\nfunction claudeVersion(id: string): { major: number; minor: number } | null {\n\t// Anchored: `claude-opus-4-beta` and `claude-opus-4.7` must not match their\n\t// leading digits and be read as old models. A dated id such as\n\t// `claude-3-5-sonnet-20241022` does not parse either, and is reported as\n\t// unrecognised rather than silently classified.\n\tconst match = /^(?:databricks-)?claude-[a-z]+-(\\d+)(?:-(\\d+))?$/.exec(id);\n\tif (!match) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tmajor: Number(match[1]),\n\t\tminor: match[2] === undefined ? 0 : Number(match[2]),\n\t};\n}\n\n/**\n * Heuristic, prefix-based capability detection for MLflow-routed Neon models.\n *\n * The unified endpoint proxies to heterogeneous upstream providers, each of\n * which accepts a different subset of the OpenAI-style parameters the AI SDK\n * emits. Sending a parameter an upstream rejects results in a hard `400`, so we\n * strip the parameters a family is known to reject and surface a warning\n * instead. Unknown/untested models stay permissive (passed through unchanged).\n */\nexport function getNeonModelCapabilities(\n\tmodelId: string,\n): NeonModelCapabilities {\n\tconst id = modelId.toLowerCase();\n\n\t// Anthropic (Claude): rejects penalties and seed, accepts only one of\n\t// temperature/topP, and rejects the OpenAI `reasoning_effort` field.\n\t//\n\t// From Claude 4.7 onward the gateway also rejects non-default sampling\n\t// entirely — `does not support the temperature parameter` /\n\t// `does not support sampling parameters: top_p` — because those models are\n\t// steered with `output_config.effort` instead. Measured: 4.1/4.5/4.6 accept\n\t// both, 4.7/4.8/5 reject both, and every id accepts the default\n\t// `temperature: 1.0`. A version comparison rather than a list of ids, so a\n\t// future Claude inherits the restriction: dropping a parameter the model\n\t// would have accepted costs a warning, claiming one it rejects costs a 400.\n\tif (id.includes(\"claude\")) {\n\t\tconst version = claudeVersion(id);\n\t\tconst sampling =\n\t\t\tversion !== null &&\n\t\t\t(version.major < 4 || (version.major === 4 && version.minor <= 6));\n\t\treturn {\n\t\t\tfamily: \"anthropic\",\n\t\t\tsupportsTemperature: sampling,\n\t\t\tsupportsTopP: sampling,\n\t\t\ttemperatureTopPMutuallyExclusive: true,\n\t\t\tsupportsPenalties: false,\n\t\t\tsupportsSeed: false,\n\t\t\tsupportsStopSequences: true,\n\t\t\tsupportsReasoningEffort: false,\n\t\t\t...(version === null ? { claudeSamplingUnrecognized: true } : {}),\n\t\t};\n\t}\n\n\t// Google (Gemini): accepts standard sampling params, and does take\n\t// `reasoning_effort` — the gateway maps it onto Gemini's thinking config.\n\t// Measured on gemini-3-6-flash: `minimal` produces 0 reasoning tokens and\n\t// `high` produces 310, against 130 with the field absent.\n\t//\n\t// Newer Gemini models are stricter, and not in a way the id predicts: the\n\t// gateway rejects penalties on `gemini-3-5-flash-lite` while accepting them\n\t// on `gemini-3-1-flash-lite`, so neither the version nor the `-lite` suffix\n\t// is the rule. The `GEMINI_NO_SAMPLING` ids refuse temperature and topP\n\t// outright (\"does not support the temperature parameter\"). Both sets above\n\t// are listed by id because that is what was measured; a new Gemini model\n\t// inherits the permissive default until someone measures it.\n\tif (id.includes(\"gemini\")) {\n\t\tconst canonical = canonicalId(id);\n\t\tconst acceptsSampling = !GEMINI_NO_SAMPLING.has(canonical);\n\t\treturn {\n\t\t\tfamily: \"google\",\n\t\t\t...PERMISSIVE,\n\t\t\tsupportsTemperature: acceptsSampling,\n\t\t\tsupportsTopP: acceptsSampling,\n\t\t\tsupportsPenalties: !GEMINI_NO_PENALTIES.has(canonical),\n\t\t};\n\t}\n\n\t// OpenAI GPT-5 reasoning family (routed to the native Responses API). The\n\t// Responses model strips parameters the Responses API doesn't accept\n\t// (penalties, seed, stop), but its reasoning-model detection matches the bare\n\t// model id (`gpt-5`), which the gateway's optional `databricks-` prefix can\n\t// defeat. So we only handle the temperature/topP restriction here: the\n\t// original gpt-5 / gpt-5-mini / gpt-5-nano require the default temperature and\n\t// reject topP, while gpt-5.1+ (a minor version digit follows) accept them\n\t// again. The regex matches both prefixed and unprefixed ids.\n\tif (/gpt-5/.test(id)) {\n\t\tconst hasMinorVersion =\n\t\t\t/gpt-5[.-]\\d/.test(id) && !GPT5_NO_SAMPLING.has(canonicalId(id));\n\t\treturn {\n\t\t\tfamily: \"openai\",\n\t\t\tsupportsTemperature: hasMinorVersion,\n\t\t\tsupportsTopP: hasMinorVersion,\n\t\t\ttemperatureTopPMutuallyExclusive: false,\n\t\t\tsupportsPenalties: true,\n\t\t\tsupportsSeed: true,\n\t\t\tsupportsStopSequences: true,\n\t\t\tsupportsReasoningEffort: true,\n\t\t};\n\t}\n\n\t// The gpt-5 minor-version rule does not match gpt-6.\n\tif (GPT6_NO_SAMPLING.has(canonicalId(id))) {\n\t\treturn {\n\t\t\tfamily: \"openai\",\n\t\t\tsupportsTemperature: false,\n\t\t\tsupportsTopP: false,\n\t\t\ttemperatureTopPMutuallyExclusive: false,\n\t\t\tsupportsPenalties: true,\n\t\t\tsupportsSeed: true,\n\t\t\tsupportsStopSequences: true,\n\t\t\tsupportsReasoningEffort: true,\n\t\t};\n\t}\n\n\t// Meta (Llama): rejects penalties and seed; accepts sampling params and stop.\n\tif (id.includes(\"llama\")) {\n\t\treturn {\n\t\t\tfamily: \"meta\",\n\t\t\tsupportsTemperature: true,\n\t\t\tsupportsTopP: true,\n\t\t\ttemperatureTopPMutuallyExclusive: false,\n\t\t\tsupportsPenalties: false,\n\t\t\tsupportsSeed: false,\n\t\t\tsupportsStopSequences: true,\n\t\t\tsupportsReasoningEffort: true,\n\t\t};\n\t}\n\n\t// Everything else on the unified endpoint rejects penalties with\n\t// `parameter \"frequency_penalty\" must be equal to 0`. Only the older Gemini\n\t// models, handled above, accept them. Seed and stop vary, so each family\n\t// carries what was measured rather than inheriting a guess.\n\tif (id.includes(\"gpt-oss\")) {\n\t\treturn {\n\t\t\tfamily: \"other\",\n\t\t\t...PERMISSIVE,\n\t\t\tsupportsPenalties: false,\n\t\t\tsupportsSeed: false,\n\t\t\tsupportsStopSequences: false,\n\t\t};\n\t}\n\n\tif (id.includes(\"qwen\") || id.includes(\"gemma\")) {\n\t\treturn {\n\t\t\tfamily: \"other\",\n\t\t\t...PERMISSIVE,\n\t\t\tsupportsPenalties: false,\n\t\t\tsupportsSeed: false,\n\t\t};\n\t}\n\n\tif (\n\t\tid.includes(\"glm\") ||\n\t\tid.includes(\"kimi\") ||\n\t\tid.includes(\"grok\") ||\n\t\tid.includes(\"deepseek\")\n\t) {\n\t\treturn { family: \"other\", ...PERMISSIVE, supportsPenalties: false };\n\t}\n\n\treturn { family: \"other\", ...PERMISSIVE };\n}\n"],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
import { openai } from "@ai-sdk/openai";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/neon-openai-tools.d.ts
|
|
5
5
|
type NeonImageGenerationArgs = {
|
|
6
6
|
background?: "auto" | "opaque" | "transparent";
|
|
7
7
|
inputFidelity?: "low" | "high";
|
|
@@ -54,6 +54,5 @@ type NeonOpenAITools = Omit<typeof openai.tools, "imageGeneration"> & {
|
|
|
54
54
|
imageGeneration: typeof imageGeneration;
|
|
55
55
|
};
|
|
56
56
|
declare const neonOpenAITools: NeonOpenAITools;
|
|
57
|
-
//#endregion
|
|
58
57
|
export { NeonImageGenerationArgs, NeonOpenAITools, imageGeneration, neonOpenAITools };
|
|
59
58
|
//# sourceMappingURL=neon-openai-tools.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UnsupportedFunctionalityError } from "@ai-sdk/provider";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
import { openai } from "@ai-sdk/openai";
|
|
4
|
-
|
|
4
|
+
// src/lib/neon-openai-tools.ts
|
|
5
5
|
const DEFAULT_IMAGE_MODEL = "gpt-image-2";
|
|
6
6
|
const imageGenerationInputSchema = z.object({});
|
|
7
7
|
const imageGenerationOutputSchema = z.object({ result: z.string() });
|
|
@@ -37,7 +37,6 @@ const neonOpenAITools = {
|
|
|
37
37
|
...openai.tools,
|
|
38
38
|
imageGeneration
|
|
39
39
|
};
|
|
40
|
-
//#endregion
|
|
41
40
|
export { imageGeneration, neonOpenAITools };
|
|
42
41
|
|
|
43
42
|
//# sourceMappingURL=neon-openai-tools.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult } from "@ai-sdk/provider";
|
|
2
2
|
import { OpenAIResponsesLanguageModel } from "@ai-sdk/openai/internal";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/neon-responses-language-model.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Language model for OpenAI models served via the Neon AI Gateway's native
|
|
@@ -16,6 +16,5 @@ declare class NeonResponsesLanguageModel extends OpenAIResponsesLanguageModel im
|
|
|
16
16
|
doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
|
|
17
17
|
doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { NeonResponsesLanguageModel };
|
|
21
20
|
//# sourceMappingURL=neon-responses-language-model.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withResponsesGatewayDefaults } from "./neon-responses-options.js";
|
|
2
2
|
import { OpenAIResponsesLanguageModel } from "@ai-sdk/openai/internal";
|
|
3
|
-
|
|
3
|
+
// src/lib/neon-responses-language-model.ts
|
|
4
4
|
/**
|
|
5
5
|
* Language model for OpenAI models served via the Neon AI Gateway's native
|
|
6
6
|
* Responses API (`/openai/v1/responses`). This route is required for models
|
|
@@ -18,7 +18,6 @@ var NeonResponsesLanguageModel = class extends OpenAIResponsesLanguageModel {
|
|
|
18
18
|
return super.doStream(withResponsesGatewayDefaults(this.modelId, options));
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { NeonResponsesLanguageModel };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=neon-responses-language-model.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LanguageModelV3CallOptions } from "@ai-sdk/provider";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/lib/neon-responses-options.d.ts
|
|
4
4
|
/** Models the gateway serves as reasoning models on this route. */
|
|
5
5
|
declare function isReasoningModelId(modelId: string): boolean;
|
|
6
6
|
/**
|
|
@@ -9,6 +9,5 @@ declare function isReasoningModelId(modelId: string): boolean;
|
|
|
9
9
|
* nothing to add.
|
|
10
10
|
*/
|
|
11
11
|
declare function withResponsesGatewayDefaults(modelId: string, options: LanguageModelV3CallOptions): LanguageModelV3CallOptions;
|
|
12
|
-
//#endregion
|
|
13
12
|
export { isReasoningModelId, withResponsesGatewayDefaults };
|
|
14
13
|
//# sourceMappingURL=neon-responses-options.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnsupportedFunctionalityError } from "@ai-sdk/provider";
|
|
2
|
-
|
|
2
|
+
// src/lib/neon-responses-options.ts
|
|
3
3
|
/**
|
|
4
4
|
* Request defaults for the Neon AI Gateway's Responses route.
|
|
5
5
|
*
|
|
@@ -63,7 +63,6 @@ function withResponsesGatewayDefaults(modelId, options) {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
//#endregion
|
|
67
66
|
export { isReasoningModelId, withResponsesGatewayDefaults };
|
|
68
67
|
|
|
69
68
|
//# sourceMappingURL=neon-responses-options.js.map
|
package/dist/lib/provider.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { EmbeddingModelV3, LanguageModelV3, ProviderV3 } from "@ai-sdk/provider"
|
|
|
6
6
|
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
7
7
|
import { z } from "zod/v4";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/lib/provider.d.ts
|
|
10
10
|
declare const neonErrorSchema: z.ZodObject<{
|
|
11
11
|
error: z.ZodObject<{
|
|
12
12
|
message: z.ZodString;
|
|
@@ -58,6 +58,5 @@ interface NeonProvider extends ProviderV3 {
|
|
|
58
58
|
declare function createNeon(options?: NeonProviderSettings): NeonProvider;
|
|
59
59
|
/** Default Neon provider instance (reads `NEON_AI_GATEWAY_*` env vars). */
|
|
60
60
|
declare const neon: NeonProvider;
|
|
61
|
-
//#endregion
|
|
62
61
|
export { NeonErrorData, NeonProvider, NeonProviderSettings, createNeon, neon };
|
|
63
62
|
//# sourceMappingURL=provider.d.ts.map
|
package/dist/lib/provider.js
CHANGED
|
@@ -12,7 +12,7 @@ import { OpenAICompatibleEmbeddingModel } from "@ai-sdk/openai-compatible";
|
|
|
12
12
|
import { NoSuchModelError } from "@ai-sdk/provider";
|
|
13
13
|
import { createJsonErrorResponseHandler, generateId, loadApiKey, loadSetting, withUserAgentSuffix, withoutTrailingSlash } from "@ai-sdk/provider-utils";
|
|
14
14
|
import { z } from "zod/v4";
|
|
15
|
-
|
|
15
|
+
// src/lib/provider.ts
|
|
16
16
|
/**
|
|
17
17
|
* Community Vercel AI SDK provider for the Neon AI Gateway.
|
|
18
18
|
*
|
|
@@ -136,7 +136,6 @@ function createNeon(options = {}) {
|
|
|
136
136
|
}
|
|
137
137
|
/** Default Neon provider instance (reads `NEON_AI_GATEWAY_*` env vars). */
|
|
138
138
|
const neon = createNeon();
|
|
139
|
-
//#endregion
|
|
140
139
|
export { createNeon, neon };
|
|
141
140
|
|
|
142
141
|
//# sourceMappingURL=provider.js.map
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","names":["VERSION","VERSION"],"sources":["../../src/lib/version.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","names":["VERSION","VERSION"],"sources":["../../src/lib/version.ts"],"mappings":"A,cAIaA,O"}
|
package/dist/lib/version.js
CHANGED
package/dist/package.js
CHANGED