Building a Secure and Scalable LLM Gateway for Financial Services

wealthsimple · Finance · 2023 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Financial-services internal GenAI platform

Wealthsimple needed a way for employees and production systems to use generative AI without sending sensitive financial data directly to public LLM providers, while still supporting provider choice, RAG, self-hosted models, multimodal workflows, and client-operations use cases.

Constraints:

Architecture

Wealthsimple built an internal LLM gateway as the secure entry point for GenAI. The gateway proxies employee and production traffic to external providers, logs outbound data, supports model selection, retries, fallback, and later OpenAI-compatible APIs. Around it, Wealthsimple added PII redaction, self-hosted open-source LLMs with llama.cpp for sensitive workflows, an Elasticsearch/OpenSearch RAG API, Streamlit-based data applications, multimodal gateway inputs, and Boosterpack as a context-grounded assistant.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  employee[Employee] --> llm-gateway[LLM Gateway]
  employee[Employee] --> boosterpack[Boosterpack]
  employee[Employee] --> data-applications-platform[Data Applications Platform]
  llm-gateway[LLM Gateway] --> pii-redaction-model[PII Redaction Model]
  llm-gateway[LLM Gateway] --> external-llm-providers[External LLM Providers]
  llm-gateway[LLM Gateway] --> self-hosted-llms[Self Hosted LLMs]
  llm-gateway[LLM Gateway] --> rag-api[RAG API]
  rag-api[RAG API] --> knowledge-bases[Knowledge Bases]
  knowledge-bases[Knowledge Bases] --> boosterpack[Boosterpack]
  data-applications-platform[Data Applications Platform] --> llm-gateway[LLM Gateway]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Employee Internal user accessing GenAI tools for programming, writing, retrieval, and productivity tasks. LLM Gateway, Boosterpack, Data Applications Platform
LLM Gateway Central secure proxy for provider access, audit trails, model choice, retries, fallback, and programmatic APIs. Employee, PII Redaction Model, External LLM Providers, Self Hosted LLMs, RAG API
PII Redaction Model Internal model that detects and redacts sensitive data before external provider calls. LLM Gateway
External LLM Providers Hosted provider models, including OpenAI, Cohere, Gemini, and Bedrock-served models. LLM Gateway
Self Hosted LLMs Llama, Mistral, and Whisper models hosted inside Wealthsimple cloud environments. LLM Gateway
RAG API Semantic-search API over indexed Wealthsimple knowledge bases. LLM Gateway, Knowledge Bases
Knowledge Bases Company context indexed through Airflow and Elasticsearch/OpenSearch for grounded retrieval. RAG API, Boosterpack
Data Applications Platform Python and Streamlit environment for internal GenAI proof-of-concepts and production data applications. Employee, LLM Gateway
Boosterpack Personal assistant grounded against public, private, and limited Wealthsimple knowledge bases. Employee, Knowledge Bases

Data flow

A user or production system sends a request through the gateway behind VPN and Okta. The gateway logs who sent what data externally, routes the request to a selected provider or self-hosted model, applies PII redaction for external providers when needed, and exposes APIs with retry and fallback. RAG workloads use Airflow to index knowledge bases into Elasticsearch/OpenSearch, while Boosterpack and data applications consume those platform building blocks.

4 supporting quotes
“Our gateway was a tool that we made available for all employees behind a VPN, gated by Okta, and it would proxy the information from the conversation”article, stated
“In the first version of our gateway, all it did was maintain an audit trail. It would track what data was being sent externally, where was it being sent externally, and who sent it.”article, stated
“In the early days of interacting with OpenAI, their servers were not the most reliable, so we increased reliability, availability through a series of retry and fallback mechanisms. We actually worked with OpenAI to increase our rate limits as well.”article, stated
“We built pipelines and DAGs in Airflow, our orchestration framework, to update and index our common knowledge bases.”article, stated

Why this architecture

Wealthsimple chose a governed platform rather than banning GenAI because secure adoption required making the safe path the easy path. The gateway gave auditability, provider optionality, reliability mechanisms, and production APIs; PII redaction and self-hosted models handled data-sensitivity tradeoffs; RAG and data applications reduced friction for grounded internal use cases.

3 supporting quotes
“we quickly got to work building a gateway that would address these concerns while also providing the freedom to explore.”article, stated
“Our vision for the gateway was to make the secure path the easy path, with the appropriate guardrails to prevent sharing sensitive information”article, stated
“we started to look into self-hosting open source LLMs. The idea was that by hosting these LLMs within our own VPCs, we didn't have to run the PII redaction model.”article, stated

Models used: OpenAI models · Cohere models · Gemini models · Anthropic models through Bedrock · Llama 2 · Mistral models · Whisper · llama.cpp

Scale

Alternatives considered (roads not taken)

Ban employee use of ChatGPT and similar public LLM providers

Rejected because: Wealthsimple wanted productivity gains while controlling data exposure through a gateway.

“a lot of companies out there, Samsung being one of them, had to actually ban ChatGPT among employees to prevent this information from getting out.”article, stated
“we quickly got to work building a gateway that would address these concerns while also providing the freedom to explore.”article, stated

Rely on PII redaction for every sensitive workflow

Rejected because: Redaction was sometimes inaccurate and interfered with relevance, while some jobs required unredacted PII.

“the PII redaction model is not always accurate, so a lot of the times it interfered with the accuracy, with the relevancies of the answers provided.”article, stated
“it needs to be able to accept some degree of PII, because that fundamentally was the data that they worked with.”article, stated

Keep a custom non-standard gateway API

Rejected because: OpenAI-compatible APIs reduced integration headaches with LangChain and the maturing GenAI ecosystem.

“we ran into a lot of headaches with integrations. We had to monkey patch and rewrite a lot of code from LangChain and other libraries”article, stated
“and other libraries and frameworks because we didn't offer a compatible API structure. We took some time in September of this year to ship v2 of our API, which did mirror the OpenAI's API specs. The lesson we learned here was that it's important to think about, as this industry, as the”article, stated

Build all GenAI platform capabilities internally

Rejected because: By 2024, improved vendor security and business-alignment pressure made managed services such as Bedrock worth adopting.

“Bedrock was a very interesting addition, because this marked a shift in our build versus buy strategy. Bedrock is AWS's managed service for interacting with foundational large language models, and it also provides the ability to deploy and fine-tune these models at scale.”article, stated
“Both of these points actually shifted our strategy to what was initially very build focus, to being a lot more buy focused.”article, stated

Patterns

model-routing (platform)

The gateway gives employees and production systems centralized access to multiple LLM providers and model choices.

“Second, we want to provide optionality. We want to provide a centralized place to interact with all of the different LLM providers.”article, stated

privacy-preserving-processing (security)

Wealthsimple combines PII redaction for external providers with self-hosted models when sensitive data must remain unredacted.

“We leveraged Microsoft residuals framework along with an NER model we developed internally to detect and redact any potentially sensitive information”article, stated
“We could encourage people to send any information to these models, because the data would stay within our cloud environments.”article, stated

rag-retrieval (retrieval)

The platform indexes company knowledge bases into Elasticsearch/OpenSearch and exposes semantic search as a RAG API.

“We offered a very simple semantic search as our first RAG API.”article, stated

fallback-degradation (resilience)

The LLM service increased reliability with retry and fallback behavior across providers.

“we increased reliability, availability through a series of retry and fallback mechanisms.”article, stated

structured-output-contract (integration)

Wealthsimple moved the gateway API toward OpenAI-compatible specs to align with ecosystem integrations.

“ship v2 of our API, which did mirror the OpenAI's API specs.”article, stated

Tradeoffs

Use a governed internal gateway rather than banning LLM tools

Chose A VPN/Okta-gated LLM gateway over A blanket employee ban on public GenAI assistants.

Rationale: The gateway allowed exploration and productivity while giving the company an audit and policy control point.

“we quickly got to work building a gateway that would address these concerns while also providing the freedom to explore.”article, stated

Self-host models for sensitive workflows

Chose Open-source LLMs running inside Wealthsimple VPCs over Redacting every prompt before external provider calls.

Rationale: Self-hosting preserved useful sensitive context while keeping data within Wealthsimple's cloud environments.

“We spent the next month building a simple framework using llama.cpp, a quantized framework for self-hosting open source LLMs.”article, stated

Adopt managed Bedrock capabilities as the market matured

Chose A more buy-focused build-versus-buy posture over Continuing to recreate all marketplace GenAI tooling internally.

Rationale: Provider security had improved, and Wealthsimple saw more leverage in business-specific applications than in rebuilding commodity platform services.

“Oftentimes, getting the most value out of our work is not by building GenAI tools that exist on the marketplace.”article, stated
“Both of these points actually shifted our strategy to what was initially very build focus, to being a lot more buy focused.”article, stated

Gotchas (what bit them)

An audit-only gateway left security gaps.

Root cause: The first gateway tracked outbound data but lacked preventive guardrails against external sharing.

Resolution: Wealthsimple added PII redaction and self-hosted LLM options.

“the first iteration of our LLM gateway had a really great paper trail, it offered very little guardrails and mechanisms to actually prevent data from being shared externally.”article, stated
“the very next thing we shipped in June of 2023 was our own PII redaction model.”article, stated

PII redaction reduced usefulness for some legitimate workflows.

Root cause: The redaction model was imperfect and some employees' jobs required sensitive context.

Resolution: Self-hosted LLMs kept data in Wealthsimple cloud environments without redaction.

“it interfered with the accuracy, with the relevancies of the answers provided.”article, stated
“by hosting these LLMs within our own VPCs, we didn't have to run the PII redaction model.”article, stated

Non-standard APIs created integration cost.

Root cause: The original gateway API did not match the emerging OpenAI API standard.

Resolution: Wealthsimple shipped a v2 API mirroring OpenAI specs.

“we ran into a lot of headaches with integrations. We had to monkey patch and rewrite a lot of code from LangChain and other libraries”article, stated

Separate GenAI tools split adoption.

Root cause: Boosterpack and the gateway created multiple places for similar GenAI needs.

Resolution: The team concluded that future investments needed to centralize tooling where work already happens.

“we actually bifurcated our tools and created two different places for people to get their GenAI needs. That was detrimental for both adoption and productivity.”article, stated
“we learned that our tools are the most valuable when injected in the places we do work”article, stated

Evaluation

Wealthsimple evaluated the platform through adoption, message volume, feature usage, survey/interview feedback, and production use cases such as client-experience triaging.

Metrics: over 2,200 daily messages · close to one-third weekly active users · slightly over half monthly active users · nearly one-third weekly multimodal feature use · two early data applications reaching production

3 supporting quotes
“In the surveys and the client interviews we did, almost everyone who used LLMs found it to significantly increase or improve their productivity.”article, stated
“Across all the different tools we offer, over 2200 messages get sent daily. Close to a third of the entire company are weekly active users.”article, stated
“Within the first few weeks of launching this, close to a third of all of our end users started leveraging a multi-modal feature at least once a week.”article, stated

Outcomes

The source describes a 2023-2024 evolution from gateway to redaction, self-hosted models, RAG, data apps, multimodal input, Bedrock adoption, and production triaging.

3 supporting quotes
“We developed and open sourced our LLM gateway, which, internally, is used by over half the company.”article, stated
“Whisper would transcribe any phone calls into text first, and then the text would be passed into the downstream system.”article, stated
“we were actually able to get huge performance boosts, which translated into so many hours saved by both our client experience agents and our clients directly themselves”article, stated