SOLWYN

TypeScript SDK Privacy

Understand exactly what the Solwyn TypeScript SDK inspects locally and what content-free data it sends to Solwyn Cloud.

Your LLM requests go directly from your application to the provider you chose. Solwyn is not a proxy for prompt or response traffic.

Solwyn Cloud receives usage and operational metadata, plus attribution tags that you explicitly provide. The TypeScript SDK does not send prompt or response content to Solwyn and does not log that content.

What the SDK inspects locally

The drop-in client inspects content inside your application process only when it is needed for:

  • Length-based token estimation before a budget check or when provider usage is unavailable
  • Minimal cross-dialect translation for an eligible failover request

The AI SDK middleware receives normalized prompt and result content as part of the middleware contract. It measures content locally for the same length-based estimation purpose. Content is reduced to derived integer counts; it is not placed in control-plane requests or SDK logs.

Provider-reported usage remains the settlement source when it is available. Estimates are heuristic, length-based, and marked as estimated. The SDK has no tokenizer dependency.

Your selected provider still receives the request content required to serve the call. When the drop-in client performs an eligible failover, the selected fallback provider receives the translated request directly from your application.

What is sent to Solwyn Cloud

The metadata needed for budget enforcement and usage reporting can include:

  • Provider and model identifiers
  • Input, output, cached, reasoning, audio, image, prediction, and tool-use token counts
  • Whether token or media usage was estimated
  • Structural media quantities such as counts, characters, seconds, resolution, and quality
  • Modality, latency, call status, service tier, and provider region
  • Call, SDK instance, reservation, and lease identifiers
  • Requested and serving provider/model attribution, attempt index, and fallback flags
  • Structural failover, denial, and velocity labels
  • Run ID, run name, and parent run ID when a Node run context is active
  • OpenTelemetry trace ID, span ID, and sampled flag when your application has an active span
  • Explicit tags supplied by your application

Other content-free control-plane messages cover budget checks and settlements, lease grant/renew/surrender, untracked-surface advisories, and provider-breaker reports. They carry the structural accounting and attribution context needed for those operations, never prompt or response content.

OpenTelemetry trace correlation

When your application already has an active OpenTelemetry span at the moment it calls a wrapped client or the AI SDK middleware, metadata events for that call include trace_id, span_id, and trace_sampled. These are random identifiers, not content. They are captured once when the call starts and reused for every event of that call, including streaming, failover hops, errors, and denials. Aggregated denial replays carry no trace. Events without an active span omit the fields.

The SDK does not depend on or install @opentelemetry/api. It reads the active span through the API's process-global registry, which requires a registered context manager. It creates no spans and reads nothing from a span except those three values: never attributes, events, trace state, or baggage. Its own code never injects trace context or baggage into requests. Reporter flushes, close-time delivery, lease renewals and surrenders, and untracked-surface advisories run without the caller's span and baggage. Budget checks and lease grants still run in the caller's context, so your application's own fetch instrumentation may add traceparent or baggage headers to them.

Disable capture with traceCorrelation: false or SOLWYN_TRACE_CORRELATION=false.

Tags are transmitted verbatim

Tags are explicit caller-provided metadata. The SDK never infers them from prompts or responses, but it transmits tag keys and values verbatim on applicable control-plane messages.

import OpenAI from "openai";
import { Solwyn } from "@solwyn/sdk";

await using client = new Solwyn(new OpenAI(), {
  apiKey: process.env.SOLWYN_API_KEY!,
  tags: {
    environment: "production",
    workload: "support",
  },
});

Treat tags as telemetry labels. Do not put secrets, prompts, responses, personal data, or any other sensitive content in them. The merged tag set is limited to 10 keys; keys may contain at most 64 characters and values at most 256 characters.

Per-call solwyn_tags are removed before an intercepted request reaches the provider. They are not special on untracked passthrough methods, where arguments pass through unchanged. Tagged calls use per-call budget checks rather than run leases so tag-scoped policy remains authoritative. See TypeScript SDK Runs for tag precedence and run attribution.

Failure and recovery metadata

Error reporting uses a structural error class name, not an exception message or provider response body. Run-stop reasons and denial sources are bounded structural labels.

If a denial receipt cannot be delivered, the reporter can fold its content-free accounting fields into a bounded aggregate for later replay. These aggregates retain the identifiers and numeric quantities required for accounting; they do not retain prompt/response content or tags.

Untracked-surface advisories describe the provider and structural method path only. They never include call arguments.

Privacy boundaries by entry point

Entry pointContent behavior
@solwyn/sdkEdge-safe core and drop-in wrapper. Local content inspection is restricted to estimation and cross-dialect translation.
@solwyn/sdk/nodeAdds AsyncLocalStorage run identity and explicit run tags; it does not inspect prompt or response content.
@solwyn/sdk/ai-sdkLocally measures normalized AI SDK prompt/result content; sends only derived counts and structural metadata to Solwyn.
@solwyn/sdk/langchainReads LangChain run IDs, run names, and graph-node names to build attribution scopes; it does not read prompt or response content.
@solwyn/sdk/openai-agentsReads workflow names, agent names, and Agents lifecycle events to build attribution scopes; it does not read prompt or response content.
@solwyn/sdk/testingRecords and validates content-free control-plane wire models; it does not inspect provider prompt or response content.

Framework tracing is separate from Solwyn. LangSmith and OpenAI Agents tracing can export prompt and response content independently of the SDK; keep framework tracing disabled when content must stay local.

On this page