nexus-agents - v2.80.0
    Preparing search index...

    Class SdkAdapter

    AI SDK adapter implementing IModelAdapter.

    Uses Vercel AI SDK (npm: ai) for model interaction instead of CLI subprocess spawning. Supports any provider that has an @ai-sdk/* package.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    providerId: string

    Provider identifier (e.g., 'anthropic', 'openai')

    modelId: string

    Model identifier (e.g., 'claude-sonnet-4', 'gpt-4o')

    capabilities: readonly ModelCapability[]

    Capabilities this model supports

    logger: ILogger

    Logger for request/response logging

    Configuration for the adapter

    Methods

    • Count tokens in text using the unified TokenEstimator.

      This provides a reasonable estimate for most use cases. Concrete adapters may override this with provider-specific tokenizers.

      Parameters

      • text: string

        Text to count tokens for

      Returns Promise<number>

      Approximate token count

    • Transform a provider-specific error into a standardized ModelError.

      Maps common error patterns to appropriate error codes:

      • Rate limiting (429, quota exceeded)
      • Timeouts (ETIMEDOUT, ESOCKETTIMEDOUT)
      • Authentication (401, 403)
      • Model unavailable (503, 502)

      Parameters

      • error: unknown

        The original error from the provider

      Returns ModelError

      A standardized ModelError