Skip to content

[FR] Make AI provider dependencies optional peerDependencies #1056

@Diluka

Description

@Diluka

Documentation issue

This suggestion relates to the dependencies configuration of the core package:

"dependencies": {
"@ai-sdk/amazon-bedrock": "^3.0.0",
"@ai-sdk/anthropic": "^3.0.0",
"@ai-sdk/azure": "^3.0.12",
"@ai-sdk/cerebras": "^2.0.14",
"@ai-sdk/cohere": "^3.0.8",
"@ai-sdk/deepinfra": "^2.0.13",
"@ai-sdk/gateway": "^3.0.16",
"@ai-sdk/google": "^3.0.0",
"@ai-sdk/google-vertex": "^3.0.25",
"@ai-sdk/groq": "^3.0.0",
"@ai-sdk/mistral": "^3.0.0",
"@ai-sdk/openai": "^3.0.0",
"@ai-sdk/openai-compatible": "^2.0.13",
"@ai-sdk/perplexity": "^3.0.8",
"@ai-sdk/togetherai": "^2.0.13",
"@ai-sdk/vercel": "^2.0.13",
"@ai-sdk/xai": "^3.0.26",
"@aihubmix/ai-sdk-provider": "^1.0.1",
"@gitlab/gitlab-ai-provider": "^3.1.1",
"@modelcontextprotocol/sdk": "^1.12.1",
"@mymediset/sap-ai-provider": "^2.1.0",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/api-logs": "^0.204.0",
"@opentelemetry/context-async-hooks": "^2.2.0",
"@opentelemetry/core": "^2.0.0",
"@opentelemetry/exporter-logs-otlp-http": "^0.204.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
"@opentelemetry/otlp-transformer": "^0.204.0",
"@opentelemetry/resources": "^2.0.0",
"@opentelemetry/sdk-logs": "^0.204.0",
"@opentelemetry/sdk-trace-base": "^2.0.0",
"@opentelemetry/sdk-trace-node": "^2.0.0",
"@opentelemetry/semantic-conventions": "^1.28.0",
"@voltagent/internal": "^1.0.3",
"fast-glob": "^3.3.3",
"gray-matter": "^4.0.3",
"micromatch": "^4.0.8",
"ollama-ai-provider-v2": "^1.5.3",
"ts-pattern": "^5.7.1",
"type-fest": "^4.41.0",
"uuid": "^9.0.1",
"workers-ai-provider": "^3.0.2",
"zod-from-json-schema": "^0.5.0",
"zod-from-json-schema-v3": "npm:zod-from-json-schema@^0.0.5"
},

Specifically, it concerns the set of AI provider dependencies declared in the project.

Describe the thing to improve

Currently, all major AI providers are included as regular dependencies, making them required for every installation. This creates unnecessary overhead: I may not use most of them, and installing so many dependencies increases the risk of version conflicts and dependency failures.

I recommend making all third-party AI providers (e.g. @ai-sdk/..., @aihubmix/ai-sdk-provider, @gitlab/gitlab-ai-provider, @mymediset/sap-ai-provider, ollama-ai-provider-v2, workers-ai-provider) optional peer dependencies instead of required dependencies. This would let users choose only the providers they need, reducing bloat and improving overall stability.

Describe the solution (optional)

Consider refactoring the package.json so AI providers are removed from required dependencies and added as optional peerDependencies instead. This could be documented clearly to help users install only what they need for their use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions