Embed AI into SaaS · San Francisco, CA
Notion AI lives inside the Notion editor. Linear's AI triage runs against your existing issue model. Figma's auto-rename uses model inference inside the canvas. Stripe Radar uses ML in the same fraud pipeline it has run since 2016. The pattern at every category-leading SF SaaS is the same: AI is a feature inside the existing product, not a separate app.
The interesting part is the engineering shape. Streaming responses through React Server Components, gateway architecture for model swaps, per-tenant prompt isolation, evaluation harnesses that catch regressions before merge. None of that is a weekend prototype.
Every AI-embedding engagement is scoped and priced per feature, based on the repo shape and the surface area of what you want to ship.
Send us the repo shape and the feature spec. We will scope it.
A San Francisco B2B SaaS at series B or C usually runs Next.js (App Router or Pages Router), or Rails 7, or a Django monolith, with a Postgres or a sharded Postgres backend, Redis for cache, and an existing event pipeline (Segment, Snowplow, or home-grown). The AI features go inside that. They do not get a separate cluster.
The streaming UI matters more than people expect. Token-by-token responses through Server-Sent Events or RSC streaming change the perceived latency from "the model is slow" to "the model is thinking out loud." The Vercel AI SDK handles the wire format, but the integration into your component tree, your auth, and your error boundaries is custom work.
The gateway pattern matters more than the streaming. A single internal service wraps every model call: the model ID is config, the prompt is versioned, the response is logged with latency and cost, the retry policy is centralized, and the rate limit is enforced before the upstream API ever sees the request. Without a gateway, you cannot ship a model swap without a deploy and you cannot answer a SOC 2 auditor.
Multi-tenant prompt isolation is the part most teams get wrong. A naive RAG implementation pulls chunks from a shared index and filters on tenant_id after retrieval. That is a data leak waiting to happen. The correct pattern is namespace-level isolation (Pinecone), row-level security (pgvector), or a tenant-scoped index per customer (cost-prohibitive above a few hundred tenants). The gateway validates tenant_id on every retrieved chunk before assembly. Anything else fails an enterprise security review.
Cost engineering is where the bills get fixed. Prompt caching with Anthropic on system prompts and long shared context. Tiered routing where Haiku handles 80 percent of calls (classification, tagging, short summarization) and Sonnet handles the 20 percent that need it. Batch API for nightly summarization jobs. Per-user token caps. Aggressive context compaction. A two-week pass on an existing AI product typically cuts the bill by 70 to 85 percent without any user-visible regression.
Single internal service wrapping every model call. Model ID as config, prompt versioning, per-tenant rate limits, cost logging per request, centralized retry policy. The Notion / Linear / Figma pattern, exposed as a library inside your repo.
Token-by-token responses through RSC streaming or the Vercel AI SDK useChat hook. Integrated with your existing auth, error boundaries, and design system. No new component library, no new state manager.
Tenant-scoped retrieval at the index level (Pinecone namespaces, pgvector with row-level security). Gateway validates every retrieved chunk before prompt assembly. Clean answer for the SOC 2 cross-tenant control.
Golden dataset of 200 to 500 production prompts. Regression metrics on every prompt change before merge. Langfuse traces wired in for drill-down on individual production calls.
Route a percentage of traffic to a new model through the gateway. Compare against the golden set. See accuracy, latency, and cost deltas before any customer touches the new model. Rollback is a config flip.
Prompt caching with Anthropic, tiered routing (Haiku for 80%, Sonnet for 20%), batch API for non-realtime work, per-user token caps, context compaction. Typical reduction on an existing AI bill is 70 to 85 percent.
San Francisco is where the in-product AI playbook gets written. These are the engineering patterns we see across the city's B2B SaaS and dev-tooling companies.
Notion-style AI assists inside the editor. Linear-style triage that reads issue content and suggests labels, owners, and priorities. Stripe-style fraud and risk signals that run on every transaction. The shape is always the same: model inside an existing workflow, latency budget under 2 seconds for interactive surfaces, streaming for anything longer.
AI command palettes, in-editor code suggestion, doc generation from code, AI-assisted log analysis. The bar is set by GitHub Copilot and Cursor. Latency tolerances are tight, the evaluation matters more than the demo, and the cost engineering is non-negotiable because dev tooling has high call volume per user.
Figma-style auto-rename, smart selection, content fill, layout suggestions. The model touches a creative surface, so output quality is judged subjectively and regression catching needs a human-rated evaluation set, not just accuracy metrics. Vercel AI SDK with custom UI components is the typical stack.
Both providers are local. The latest features (prompt caching, batch API, structured outputs, computer use, extended thinking) show up in production at SF SaaS faster than anywhere else. We track the changelog of both SDKs and migrate clients quickly when a feature meaningfully reduces cost or improves output.
Tell us your stack (Next, Rails, Django, Node), your existing data model, and the feature you want to ship. We reply within one business day with a repo-aware scope and a price range.