Repository navigation
V4 alignment: vendor package alignment #231
Description
Conventions
doc=docs/aisdk-architecture-alignment.mdon master a8e3a99.PIPE=docs/ai-sdk-request-pipeline.md(RFC-0031).R35=rfc/0035-host-side-tool-call-repair.md.m:= master a8e3a99.v4:= the V4 code from the Draft stack refactor(core)!: align public core types with the AI SDK V4 shapes #219 → feat(providers)!: AI SDK-shaped provider factories, request layer and replay tests #214 → fix(providers)!: align vendor packages with upstream and add missing model families #220 → refactor(core)!: public JSON equals the AI SDK JSON, one provider construction path #225 → refactor(providers)!: data-only provider configuration and stream structs #227, as combined in the split layers (D2fb0f79e5+ E28ae9b2e7). Line numbers can be off by a few lines against refactor(providers)!: data-only provider configuration and stream structs #227's head.- Layers A1 … E2 are the planned split of that Draft stack into small PRs to master (branches
rfc-0036/<layer>). "Fixed in: layer X" means the fix goes into that layer's PR. - Upstream is quoted from the npm tarballs:
ai@7.0.122,@ai-sdk/provider@4.0.19,@ai-sdk/provider-utils@5.0.51, and so on, newer versions named where they matter. V4 pins ai 7.0.127, provider 4.0.21, provider-utils 5.0.53 (fixtures/aisdk/VERSIONS.json). - Item keys (B*, C*, U*, N*, S2-*) are ids from our per-requirement check of the merged RFCs against upstream; they are kept so items can be traced.
- small master PR: an independent fix to master. alignment migration: the code lags a correct doc; this is the AI SDK alignment work itself.
Why. Several vendor packages diverge from their pinned upstream packages. The main case: when layer E1 merged, openai-compatible lost its settings for extension points. Other upstream subpaths and fields are also missing.
Fixed in.
- B1 to B3: layer E1 (and C1 for B2).
- B21: layer B6.
- N3: layer C1.
- The rest: alignment migration.
Existing fixes. For B1, the D line still has the closure implementation (fb0f79e5: aimux-providers/src/openai_compatible/mod.rs:90-92, config.rs:154). Layer E1 (7330a6e) removed it. Restore the D-line version.
Checklist
- B1 (U22):
transformRequestBodyandmetadataExtractorwere deleted from openai-compatible.- Evidence:
v4: aimux-providers/src/openai_compatible/has neither. - Doc: doc:159 (D15), :797, :1571. Upstream:
@ai-sdk/openai-compatible@3.0.62 openai-compatible-provider.ts:107, :114, :185-186,openai-compatible-chat-language-model.ts:401, :451-452(the extractor also covers streams). - Fixed in: layer E1. Restore (decided).
- Evidence:
- B2:
supportsMultiPartToolContentis missing.- Evidence: layers B3 to B8 had an internal field (
config.rs:133); C1 deleted it, and no layer exposes a setting. - Upstream:
openai-compatible-provider.ts:100, :183,convert-to-openai-compatible-chat-messages.ts:183, :304. - Fixed in: layer C1, exposed as a public setting (decided).
- Evidence: layers B3 to B8 had an internal field (
- B3:
convertUsagebecame a closed enum, andsupportedUrlsbecame static data.- Evidence:
v4: aimux-providers/src/openai_compatible/config.rs:57, :130-131,mod.rs:84-86. The D line has closures (fb0f79e5 config.rs:25, :131). - Upstream:
openai-compatible-provider.ts:119, :125(functions). - Fixed in: layer E1. Keep the closures (decided).
- Evidence:
- B21: the Anthropic stream never emits
Raw, and theinclude_raw_chunkscomment is stale.- Evidence: no
StreamPart::Rawinv4: aimux-providers/src/anthropic/stream.rs.v4: aimux-core/src/options.rs:203-213says only the OpenAI-compatible family honours it; 18 files do. - Doc: doc:109, RFC-0036:43. Upstream:
@ai-sdk/anthropic@4.0.68 anthropic-language-model.ts:1948-1949. - Fixed in: layer B6.
- Evidence: no
- N3: stale doc comments say the status code is "observed status only", while
openai_stream_errorinfers a status from the error code or type.- Evidence:
v4: aimux-core/src/error.rs:618-623(status_code()),v4: aimux-provider-utils/src/response_handler.rs:296-304(stream_error_api_call), againstv4: aimux-providers/src/openai/mod.rs:87-175. Layer C1 (573de7e) introduced the inference. - Upstream:
@ai-sdk/openai@4.0.80 src/openai-stream-error.ts:27-34, :240-266, :286-290(the inference is correct). - Fixed in: layer C1. Comments only.
- Evidence:
- C15: Vertex
maasandxaisubpaths are missing.- Evidence:
v4: aimux-providers/src/vertex/has neither. - Doc: doc:769. Upstream:
@ai-sdk/google-vertex@5.0.98 src/maas,src/xai.
- Evidence:
- C16: Anthropic InvokeModel on Bedrock is missing.
- Evidence:
v4: aimux-providers/src/bedrock/has noanthropic. - Doc: doc:768. Upstream:
@ai-sdk/amazon-bedrock@5.0.100 src/anthropic,amazon-bedrock-anthropic-fetch.ts:14-63. - Either implement it, or register it as a product difference in doc §5 with layer B6.
- Evidence:
- C17:
openai_outputalways readsopenai.logprobs, whatever the provider namespace.- Evidence:
v4: aimux-core/src/openai_output.rs:347. - Doc: doc:820.
- Evidence:
- C50: the custom provider does not forward discovery.
- Evidence:
v4: aimux-core/src/custom_provider.rs:145-152forwards files and skills only. - Doc: doc:1593. Upstream:
ai@7.0.122 src/registry/custom-provider.ts:64(no discovery; the doc requires forwarding).
- Evidence:
- U26: speech results lack
usage.- Evidence:
v4: aimux-core/src/speech_model.rshas no usage field, but V4 pins provider 4.0.21. - Upstream:
@ai-sdk/provider@4.0.21 src/speech-model/v4/speech-model-v4-result.ts:27(usage?: JSONObject). - The tracing half of U26 is done after the migration, together with C3 (telemetry split).
- Evidence:
- Note, doc carry only (no code): A1, A3 and A7 doc edits travel with layers B3, B4 and B3; see the planned alignment-doc PR plan. They are listed here so the vendor layers' PR descriptions pick them up.
Checklist: further items
-
N4.1-1: Azure lacks
deepseek()andcompletion().- Evidence: upstream
azure@4.0.84 src/azure-openai-provider.ts:52-67, :327-341reuses@ai-sdk/deepseek/internaland the OpenAI completion model.v4: aimux-providers/src/azure/mod.rs:437-502has only chat, responses, embedding, image, transcription and speech. doc:764. - Fixed in: layer C1. If not ported, register it in the doc's known-gaps list.
- Evidence: upstream
-
NP2-4: OpenAI Responses reasoning is not merged by item id (RSN-13).
- Evidence:
v4: aimux-providers/src/openai/responses/convert.rs:333-380pushes each reasoning part separately, sostore=truerepeatsitem_referenceandstore=falsesplits one item into several. Upstreamopenai@4.0.80 src/responses/convert-to-openai-responses-input.ts:651, :1158-1209merges summaries perreasoningIdand sendsitem_referenceonce. - Fixed in: layer B4.
- Evidence:
-
N31-5.2-1: provider-utils exports an OpenAI-shaped shared error handler. Also on master. Low priority.
- Evidence:
v4: aimux-provider-utils/src/response_handler.rs:222(create_standard_json_error_response_handler), used by 11 providers (groq, deepseek, jev, linkup, parallel_ai, serper, tinyfish, you_com, azure transcription, …). PIPE:261-268 forbids it. Upstream provider-utils has onlycreateJsonErrorResponseHandler; each package defines its own error schema. - Fixed in: the layers that own those providers (B4/B5/B7).
- Evidence:
-
S2-4: Anthropic-AWS differs from upstream
@ai-sdk/anthropic-aws2.0.60.- Upstream
anthropic-aws-provider.ts:workspaceIdis required and read fromANTHROPIC_AWS_WORKSPACE_IDat request time (:219-227); region comes fromAWS_REGION(:136-141, :210-217); with noapiKey/ANTHROPIC_AWS_API_KEYit signs with SigV4 from env AWS credentials (:128-134, :160-178). - Ours (
v4: aimux-providers/src/anthropic_aws/mod.rs:60-76, :130-148): workspace optional and not read from env, region defaults tous-east-1and never reads env, onlyx-api-key. - Fixed in: layer C1. Add the Anthropic-AWS row to the doc's §3.3 per-package timing table.
Acceptance. Port the upstream openai-compatible tests:transformRequestBody,metadataExtractor(generate and stream), and multi-part tool content. Add an Anthropic raw-chunk test, plus fixtures for the new subpaths.
- Upstream
Activity
cunninghamcard-bit commentedon Oct 14, 2026
更新一下本 issue 的承载 PR,以下条目已实现、待合并:
C16(Bedrock Anthropic InvokeModel)和 N4.1-1(Azure deepseek/completion)已在 alignment 文档 §5 登记为产品差异,对应能力未移植。
本次核对了云端源码,未运行测试。