Can You Change Embedding Dimensions Through AI SDK Without Changing Your Model?

Only if the existing model supports dimension configuration. AI SDK exposes a way to request an embedding length; it does not make every embedding model resizable. For a RAG application, the decision to change the request and the decision to change the vector-store schema should be separate gates.

The AI SDK OpenAI Compatible Providers documentation, captured on September 12, 2026, describes dimensions as a numeric embedding option and adds the important restriction: “Only supported in models that allow dimension configuration.”

What the option actually establishes

The documented embedding factory is provider.embeddingModel(...). The page’s example uses a placeholder model, text-embedding-model, and requests dimensions: 512 under providerOptions.providerName.

That example establishes where to put the request, not which real models accept 512 dimensions. It is not a supported-size table or evidence that the SDK will resize an arbitrary output vector for you.

There is also a configuration detail worth checking before diagnosing model support: the provider-specific options section says the option namespace is camelCase. A provider named provider-name still uses providerOptions.providerName. Correct placement and backend support are separate questions; getting one right does not establish the other.

A schema-change gate, not just a request edit

My recommendation is to use the following checks before committing to a new vector length:

Gate Evidence to collect Decision if it is missing
Model and endpoint support Documentation for the exact deployed model and endpoint accepting the intended dimension value Keep the default-size path; do not infer support from the SDK example
Baseline shape Actual output length with the dimension option omitted, alongside the model identifier and endpoint Establish the baseline before proposing a replacement schema
Requested shape Returned vector lengths with the option set, checked on both document and query embedding paths Hold the schema change if lengths differ from the intended size or remain unverified

For reproducibility, record the SDK version, provider name, model identifier, requested dimension, observed lengths, and test inputs in the test record. Keep secrets out of it. Add an application-side length check at the ingestion and query boundaries rather than relying on the requested number as proof of the returned shape.

These are engineering safeguards, not claims that AI SDK performs those checks automatically. If the requested size is unsupported, this page does not specify whether the backend rejects the request, ignores the option, or behaves another way. Do not design a fallback around an assumed failure mode.

Shape is only the first acceptance criterion

A confirmed output length answers the schema question, not whether retrieval remains useful. As a separate evaluation step, compare the proposed configuration with the default baseline using the same corpus, queries, and relevance judgments. Define the retrieval metric and acceptance threshold before deciding to migrate. No retrieval-quality improvement or cost saving is established by this documentation.

The practical stopping rule is simple: keep the model only if its dimension support is confirmed, and keep the existing schema until the returned shape is verified. If support cannot be established, retain the model’s default output size rather than treating dimensions as a universal resizing switch.