flexinference 1.5.2 → 1.5.4
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/CHANGELOG.md +20 -1
- package/README.md +2 -2
- package/dist/index.js +3 -8
- package/dist/types.d.ts +7 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.4
|
|
4
|
+
|
|
5
|
+
Documentation-only release. Corrects the error-code name in the generated 400 response
|
|
6
|
+
descriptions and the 1.5.3 changelog entry: the API emits `flex_model_not_capable`; earlier
|
|
7
|
+
docs misspelled it as `model_not_flex_capable` (a code the API never returns). No code changes.
|
|
8
|
+
|
|
9
|
+
## 1.5.3
|
|
10
|
+
|
|
11
|
+
Relaxes Messages `max_tokens` on the FlexInference side. The SDK no longer requires or
|
|
12
|
+
runtime-validates it before sending a `/messages` request; FlexInference forwards it when
|
|
13
|
+
set and lets Anthropic return its own request error when it is omitted.
|
|
14
|
+
|
|
15
|
+
## 1.5.2
|
|
16
|
+
|
|
17
|
+
Adds zero-dependency runtime request validation matching the Python SDK: a request is now
|
|
18
|
+
checked for `model` and the per-endpoint required fields before it is sent, with the two SDKs
|
|
19
|
+
held to identical behavior by shared parity fixtures. The generated `Error` type also gains a
|
|
20
|
+
`doc_url` field, so an error now carries a link to its documentation.
|
|
21
|
+
|
|
3
22
|
## 1.5.1
|
|
4
23
|
|
|
5
24
|
Small robustness fixes for the transport, no API changes. A non-streaming request that hits
|
|
@@ -93,7 +112,7 @@ required and aligns its values with OpenAI's `service_tier` vocabulary.
|
|
|
93
112
|
- **Any model proxies for the non-flex values.** `"default"`, `"priority"`, and
|
|
94
113
|
`"auto"` proxy any model to OpenAI. Only the duration (flex race) requires a
|
|
95
114
|
flex-capable model; a duration on a non-flex-capable model returns the router's new
|
|
96
|
-
`
|
|
115
|
+
`flex_model_not_capable` error (the old `unsupported_model` is retired).
|
|
97
116
|
|
|
98
117
|
### Added
|
|
99
118
|
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ FlexInference routes to **OpenAI**, **Google Gemini**, and **Anthropic**. Send t
|
|
|
34
34
|
|
|
35
35
|
- **OpenAI:** `default` (the standard tier), `priority`, `auto`, and flex on flex-capable models. You reach flex by passing a duration.
|
|
36
36
|
- **Gemini:** `default` maps to Gemini's standard tier. You also get `priority` and flex on the Gemini flex models (`gemini-3.5-flash`, `gemini-3.1-flash-lite`, `gemini-3.1-pro-preview`, `gemini-3-flash-preview`, `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`). Gemini has no `auto` tier, so `start_within: "auto"` on a Gemini model returns `400`.
|
|
37
|
-
- **Anthropic (Claude):** proxy-only. `default`, `priority`, and `auto` work; there is **no flex tier**, so a duration `start_within` on a `claude-*` model returns `400 flex_unsupported_for_anthropic`. Anthropic requires
|
|
37
|
+
- **Anthropic (Claude):** proxy-only. `default`, `priority`, and `auto` work; there is **no flex tier**, so a duration `start_within` on a `claude-*` model returns `400 flex_unsupported_for_anthropic`. Anthropic requires an output-token field upstream. FlexInference forwards `max_output_tokens` (`max_completion_tokens` on Chat, `max_tokens` on Messages) when set and does not synthesize a default, so omitting it returns Anthropic's own request error. You keep the unified API and tier control, and draw down your own Anthropic credits.
|
|
38
38
|
|
|
39
39
|
Add the provider key you'll use (OpenAI, Gemini, and/or Anthropic) in the [dashboard](https://www.flexinference.com/dashboard). Text, streaming, structured outputs, function calling, image input, and web search work across providers (send a Responses `web_search` tool; we map it to Gemini's `google_search`).
|
|
40
40
|
|
|
@@ -85,7 +85,7 @@ console.log(interactionText(res));
|
|
|
85
85
|
|
|
86
86
|
## Messages (Anthropic shape)
|
|
87
87
|
|
|
88
|
-
Speak Anthropic's Messages shape and reach any model. `max_tokens`
|
|
88
|
+
Speak Anthropic's Messages shape and reach any model. Anthropic requires `max_tokens` upstream. FlexInference forwards it when set and does not synthesize a default, so omitting it returns Anthropic's own request error. `messageText(res)` pulls the assistant text out of the message `content`.
|
|
89
89
|
|
|
90
90
|
```ts
|
|
91
91
|
import { messageText } from "flexinference";
|
package/dist/index.js
CHANGED
|
@@ -162,9 +162,7 @@ function parseStartWithin(value) {
|
|
|
162
162
|
const match = DURATION_RE.exec(value);
|
|
163
163
|
if (match === null)
|
|
164
164
|
return { kind: "invalid", reason: "malformed", value };
|
|
165
|
-
const seconds = Number(match[1]) * SECONDS_PER_HOUR +
|
|
166
|
-
Number(match[2]) * SECONDS_PER_MINUTE +
|
|
167
|
-
Number(match[3]);
|
|
165
|
+
const seconds = Number(match[1]) * SECONDS_PER_HOUR + Number(match[2]) * SECONDS_PER_MINUTE + Number(match[3]);
|
|
168
166
|
return { kind: "duration", value, seconds };
|
|
169
167
|
}
|
|
170
168
|
// Runtime guard so plain-JS callers (who get no compile-time check) still fail
|
|
@@ -191,7 +189,7 @@ function assertStartWithin(body) {
|
|
|
191
189
|
}
|
|
192
190
|
// Per-endpoint required fields beyond the model/start_within envelope. Mirrors the Python
|
|
193
191
|
// _RequestSpec table in _validation.py: responses/interactions require `input` (presence only);
|
|
194
|
-
// chat
|
|
192
|
+
// chat/messages require `messages` (array).
|
|
195
193
|
const RESPONSES_REQUEST_SPEC = {
|
|
196
194
|
required: [{ name: "input", kind: "present" }],
|
|
197
195
|
};
|
|
@@ -202,10 +200,7 @@ const INTERACTIONS_REQUEST_SPEC = {
|
|
|
202
200
|
required: [{ name: "input", kind: "present" }],
|
|
203
201
|
};
|
|
204
202
|
const MESSAGES_REQUEST_SPEC = {
|
|
205
|
-
required: [
|
|
206
|
-
{ name: "messages", kind: "array" },
|
|
207
|
-
{ name: "max_tokens", kind: "finiteNumber" },
|
|
208
|
-
],
|
|
203
|
+
required: [{ name: "messages", kind: "array" }],
|
|
209
204
|
};
|
|
210
205
|
// Read one field by reference off the raw body without copying it. `undefined` (or a non-object
|
|
211
206
|
// body) is treated as missing; `null` counts as present, matching Python's `name in body`
|
package/dist/types.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ export interface paths {
|
|
|
90
90
|
};
|
|
91
91
|
get?: never;
|
|
92
92
|
put?: never;
|
|
93
|
-
/** Create a message. The fourth FlexInference caller format (Anthropic Messages shape in and out); works for any model via the canonical Responses path. Send start_within and do not send service_tier. max_tokens
|
|
93
|
+
/** Create a message. The fourth FlexInference caller format (Anthropic Messages shape in and out); works for any model via the canonical Responses path. Send start_within and do not send service_tier. Anthropic requires max_tokens upstream. FlexInference forwards it when set and does not synthesize a default, so omitting it returns Anthropic's own request error. */
|
|
94
94
|
post: operations["createMessage"];
|
|
95
95
|
delete?: never;
|
|
96
96
|
options?: never;
|
|
@@ -5794,11 +5794,11 @@ export interface components {
|
|
|
5794
5794
|
};
|
|
5795
5795
|
/**
|
|
5796
5796
|
* Message Create Params
|
|
5797
|
-
* @description Request body for POST /v1/messages (Anthropic Messages shape). Works for any model via the canonical Responses path. max_tokens
|
|
5797
|
+
* @description Request body for POST /v1/messages (Anthropic Messages shape). Works for any model via the canonical Responses path. Anthropic requires max_tokens upstream. FlexInference forwards it when set and does not synthesize a default, so omitting it returns Anthropic's own request error. Does not accept service_tier (the router owns the tier). start_within is required at runtime but left optional here.
|
|
5798
5798
|
*/
|
|
5799
5799
|
MessageCreateParams: {
|
|
5800
5800
|
model: string;
|
|
5801
|
-
max_tokens
|
|
5801
|
+
max_tokens?: number;
|
|
5802
5802
|
/** @description System prompt as a string or an array of text blocks. */
|
|
5803
5803
|
system?: string | components["schemas"]["MessageTextBlock"][];
|
|
5804
5804
|
messages: components["schemas"]["Message"][];
|
|
@@ -6007,7 +6007,7 @@ export interface operations {
|
|
|
6007
6007
|
"text/event-stream": components["schemas"]["CreateChatCompletionStreamResponse"];
|
|
6008
6008
|
};
|
|
6009
6009
|
};
|
|
6010
|
-
/** @description Bad request. A FlexInference-layer rejection (type flexinference_error, e.g. missing_start_within, invalid_start_within,
|
|
6010
|
+
/** @description Bad request. A FlexInference-layer rejection (type flexinference_error, e.g. missing_start_within, invalid_start_within, flex_model_not_capable, no_byok_key, no_gemini_key, auto_unsupported_for_gemini, service_tier_not_allowed) or an OpenAI/Gemini rejection passed through unchanged. */
|
|
6011
6011
|
400: {
|
|
6012
6012
|
headers: {
|
|
6013
6013
|
[name: string]: unknown;
|
|
@@ -6050,7 +6050,7 @@ export interface operations {
|
|
|
6050
6050
|
"text/event-stream": components["schemas"]["ResponseStreamEvent"];
|
|
6051
6051
|
};
|
|
6052
6052
|
};
|
|
6053
|
-
/** @description Bad request. A FlexInference-layer rejection (type flexinference_error, e.g. missing_start_within, invalid_start_within,
|
|
6053
|
+
/** @description Bad request. A FlexInference-layer rejection (type flexinference_error, e.g. missing_start_within, invalid_start_within, flex_model_not_capable, no_byok_key, no_gemini_key, auto_unsupported_for_gemini, service_tier_not_allowed) or an OpenAI/Gemini rejection passed through unchanged. */
|
|
6054
6054
|
400: {
|
|
6055
6055
|
headers: {
|
|
6056
6056
|
[name: string]: unknown;
|
|
@@ -6093,7 +6093,7 @@ export interface operations {
|
|
|
6093
6093
|
"text/event-stream": components["schemas"]["InteractionStreamEvent"];
|
|
6094
6094
|
};
|
|
6095
6095
|
};
|
|
6096
|
-
/** @description Bad request. A FlexInference-layer rejection (type flexinference_error, e.g. missing_start_within, invalid_start_within,
|
|
6096
|
+
/** @description Bad request. A FlexInference-layer rejection (type flexinference_error, e.g. missing_start_within, invalid_start_within, flex_model_not_capable, auto_unsupported_for_gemini, service_tier_not_allowed) or an OpenAI/Gemini rejection passed through unchanged. */
|
|
6097
6097
|
400: {
|
|
6098
6098
|
headers: {
|
|
6099
6099
|
[name: string]: unknown;
|
|
@@ -6136,7 +6136,7 @@ export interface operations {
|
|
|
6136
6136
|
"text/event-stream": components["schemas"]["MessageStreamEvent"];
|
|
6137
6137
|
};
|
|
6138
6138
|
};
|
|
6139
|
-
/** @description Bad request. A FlexInference-layer rejection (type flexinference_error, e.g. missing_start_within, invalid_start_within,
|
|
6139
|
+
/** @description Bad request. A FlexInference-layer rejection (type flexinference_error, e.g. missing_start_within, invalid_start_within, flex_model_not_capable, flex_unsupported_for_anthropic, service_tier_not_allowed) or an upstream provider rejection passed through unchanged. */
|
|
6140
6140
|
400: {
|
|
6141
6141
|
headers: {
|
|
6142
6142
|
[name: string]: unknown;
|
package/package.json
CHANGED