<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nukri Basharuli</title>
    <description>The latest articles on DEV Community by Nukri Basharuli (@nukri_basharuli_e44af0e65).</description>
    <link>https://dev.to/nukri_basharuli_e44af0e65</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4254626%2Fdaa78549-b8ec-44b9-bd68-f216e416e983.png</url>
      <title>DEV Community: Nukri Basharuli</title>
      <link>https://dev.to/nukri_basharuli_e44af0e65</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nukri_basharuli_e44af0e65"/>
    <language>en</language>
    <item>
      <title>De-identifying medical records with MedGemma so that no one sees the raw data: a look at a live deployment</title>
      <dc:creator>Nukri Basharuli</dc:creator>
      <pubDate>Fri, 20 Nov 2026 00:10:22 +0000</pubDate>
      <link>https://dev.to/nukri_basharuli_e44af0e65/de-identifying-medical-records-with-medgemma-so-that-no-one-sees-the-raw-data-a-look-at-a-live-4c3e</link>
      <guid>https://dev.to/nukri_basharuli_e44af0e65/de-identifying-medical-records-with-medgemma-so-that-no-one-sees-the-raw-data-a-look-at-a-live-4c3e</guid>
      <description>&lt;p&gt;&lt;em&gt;By Nukri Basharuli and George Zhgenti&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;JointSpace is a physical therapy clinic in Dubai. It wanted a model that could read a patient's full rehab history — comorbidities, progress notes, therapist comments — and help plan treatment. A hosted API was off the table: their clinical director put it plainly, sending data to external APIs was a non-starter. Running a model of the right quality in-house wasn't realistic either.&lt;/p&gt;

&lt;p&gt;Yma Health solved this with us, and it's now in production with two customers: the clinic and Simplex Himes, a certified EHR provider in the UAE. Below is how it works, a code pattern you can adapt, and how this maps to HIPAA and GDPR if you're not in Dubai.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why standard de-identification wasn't enough
&lt;/h2&gt;

&lt;p&gt;The regulator is the Dubai Health Authority. DHA treats data as personal unless both direct identifiers and quasi-identifiers are removed. Stripping the name and the Emirates ID number doesn't get you there. Age plus neighborhood plus a rare diagnosis plus an employer often points to exactly one person.&lt;/p&gt;

&lt;p&gt;Rules and regexes catch direct identifiers but miss context. They won't flag "the only commercial pilot among the clinic's patients." A model will. So Yma gave the de-identification job to Google's MedGemma 27B, a multimodal model that reads both the text of a record and its images.&lt;/p&gt;

&lt;p&gt;That creates a different problem. To de-identify a record, the model first has to read it raw, so the raw record has to reach wherever the model runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The architecture
&lt;/h2&gt;

&lt;p&gt;Yma calls its layer a "VPN for healthcare." It's middleware that runs on Super Protocol inside attested confidential environments. The flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Yma requests data from the middleware.&lt;/li&gt;
&lt;li&gt;The middleware queries the clinic's EHR.&lt;/li&gt;
&lt;li&gt;Raw records come back over secure tunnels straight into the confidential environment.&lt;/li&gt;
&lt;li&gt;MedGemma, inside that environment, removes identifiers and keeps the clinical context.&lt;/li&gt;
&lt;li&gt;Only the de-identified output goes out to Yma. Inference on it then runs on NVIDIA B200 GPUs in Nebius AI Cloud, also in confidential mode.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of the participants sees the raw records: not Simplex, not Yma, not Super, not Nebius, not the preprocessing provider. No changes were made to the certified EHR systems, and the clinics kept their existing workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  The code: a de-identification step
&lt;/h2&gt;

&lt;p&gt;The snippets below are our own example. They follow the same pattern as the production setup, but they aren't Yma's code. MedGemma runs here as a dedicated deployment inside a confidential environment, not as a model from the shared Router catalog. It exposes an OpenAI-compatible API, so the client code is the same as in our &lt;a href="https://dev.to/nukri_basharuli_e44af0e65/point-your-openai-client-at-a-model-that-cant-read-your-prompts-and-check-that-before-the-first-2mmb"&gt;previous post on Confidential Router&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;deid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://127.0.0.1:8787/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# via Gatekeeper&lt;/span&gt;

&lt;span class="no"&gt;SYSTEM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"""You de-identify clinical records.
Remove direct identifiers: names, ID numbers, phone, email, addresses,
exact dates (keep the year and relative intervals like "3 weeks after surgery").
Remove or generalize quasi-identifiers: employer, rare occupation,
nationality, small-area location, rare family details.
Do not change clinical content: diagnoses, medications, measurements, findings.
Return JSON: {"text": "...", "removed": [{"type": "...", "original": "..."}]}"""&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;deidentify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;deid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"medgemma-27b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;response_format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"json_object"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"system"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;SYSTEM&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A model's output is probabilistic, so it doesn't get the final say. A deterministic check runs after it, and that check decides whether a record leaves:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;PATTERNS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"emirates_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"\b784-?\d{4}-?\d{7}-?\d\b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"phone"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;       &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"\+?971[\s-]?\d{1,2}[\s-]?\d{3}[\s-]?\d{4}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;       &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"[\w.+-]+@[\w-]+\.[\w.]+"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"full_date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;   &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"\b\d{1,2}[/.-]\d{1,2}[/.-]\d{2,4}\b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;release_ok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;PATTERNS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;
    &lt;span class="c1"&gt;# nothing the model says it removed may still be in the output&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"original"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"removed"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;deidentify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;release_ok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;send_to_yma&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;quarantine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_record_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# stays inside the enclave, flagged for review&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where this runs matters. &lt;code&gt;deidentify&lt;/code&gt;, &lt;code&gt;release_ok&lt;/code&gt; and the raw record all live inside the confidential environment. If the model misses something and the check catches it, the raw record goes nowhere: it stays inside and gets flagged for review. In a conventional setup, a de-identification miss means the operator of the machine running the model has already had access to raw PHI.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you're in the US: HIPAA
&lt;/h2&gt;

&lt;p&gt;HIPAA gives you two routes to de-identification. Safe Harbor means removing 18 listed identifier types. Expert Determination means a qualified expert concludes the re-identification risk is very small. DHA's approach to quasi-identifiers is closer to the second. An LLM step doesn't make data de-identified under HIPAA on its own; your expert and your method do.&lt;/p&gt;

&lt;p&gt;There's a second piece. While raw records are being processed inside the environment, they're PHI. Since 2016, HHS guidance has been clear that a cloud provider is a business associate even if it stores only encrypted ePHI and has no key. Confidential computing doesn't remove the need for a BAA. What it does is shrink the set of people who can technically see the data, and make that verifiable. Super signs BAAs.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you're in the EU: GDPR
&lt;/h2&gt;

&lt;p&gt;Under GDPR, pseudonymized data is still personal data. Only truly anonymous data falls outside the regulation (Recital 26), and the bar is high — the same quasi-identifier logic DHA uses. Processing raw records is processing health data, a special category under Article 9. You'll need a DPA with each processor and most likely a DPIA. Attestation helps you show technical measures under Article 32: you have cryptographic proof of which code processed the data and that the operator couldn't access it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The results
&lt;/h2&gt;

&lt;p&gt;As reported by Yma and its customers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;zero changes to certified EHR systems;&lt;/li&gt;
&lt;li&gt;100% compliance with DHA anonymization rules;&lt;/li&gt;
&lt;li&gt;two customers live.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sergei Savvov, Yma's co-founder and CTO, says they previously had to write extensive custom anonymization code; MedGemma now does that work inside the secure environment. Google features the project in its Health AI Developer Foundations showcase.&lt;/p&gt;

&lt;p&gt;Full case study: &lt;a href="https://superprotocol.com/case-studies/yma" rel="noopener noreferrer"&gt;superprotocol.com/case-studies/yma&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>healthcare</category>
      <category>privacy</category>
      <category>security</category>
    </item>
    <item>
      <title>Point your OpenAI client at a model that can't read your prompts — and check that before the first request</title>
      <dc:creator>Nukri Basharuli</dc:creator>
      <pubDate>Fri, 20 Nov 2026 00:09:46 +0000</pubDate>
      <link>https://dev.to/nukri_basharuli_e44af0e65/point-your-openai-client-at-a-model-that-cant-read-your-prompts-and-check-that-before-the-first-2mmb</link>
      <guid>https://dev.to/nukri_basharuli_e44af0e65/point-your-openai-client-at-a-model-that-cant-read-your-prompts-and-check-that-before-the-first-2mmb</guid>
      <description>&lt;p&gt;&lt;em&gt;By Nukri Basharuli and George Zhgenti&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here's a setup we see a lot. A claims team at an insurer has a working prototype on the OpenAI SDK that writes a short summary of each claim file. Then legal asks who else can see the claim text while the model is running. For any hosted API, the honest answer is the provider and whoever operates the GPUs, at least technically. The contract and the retention policy say they won't look. You have no way to check.&lt;/p&gt;

&lt;p&gt;This post shows how to move that prototype to Confidential Router with almost no code changes, and how to verify where your data is going before every request.&lt;/p&gt;

&lt;h2&gt;
  
  
  The code change
&lt;/h2&gt;

&lt;p&gt;Router speaks the standard OpenAI API. In Python you change &lt;code&gt;base_url&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://127.0.0.1:8787/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# local Gatekeeper&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"sk-tee-v1-..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;model-id&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# from GET /v1/models&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Summarize this claim file: ..."&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the URL points to localhost, not to our servers. That's Gatekeeper, a small local process that checks the remote endpoint first and only then lets traffic through. Streaming, tool calling and &lt;code&gt;/v1/embeddings&lt;/code&gt; (on models that support it) work the way you'd expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Gatekeeper
&lt;/h2&gt;

&lt;p&gt;It's a single static binary with no dependencies, for Linux, macOS and Windows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://github.com/Super-Protocol/confidential-router/releases/latest/download/install.sh &lt;span class="o"&gt;|&lt;/span&gt; sh
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$HOME/.local/bin:$PATH"&lt;/span&gt;
gatekeeper init
gatekeeper endpoint add router --upstream https://api.router.superprotocol.com --listen 127.0.0.1:8787
gatekeeper endpoint trust add router --from-upstream
gatekeeper run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;trust add&lt;/code&gt; pins one specific deployment. It writes that deployment's &lt;code&gt;evidenceDigest&lt;/code&gt; to your config: a SHA-256 over a snapshot of everything deployed, with container images pinned by digest. If we ship a new version, Gatekeeper stops forwarding requests until you approve the new digest yourself. In a regulated environment that's the behavior you want: a change to how your data is processed goes through you.&lt;/p&gt;

&lt;h2&gt;
  
  
  What gets checked
&lt;/h2&gt;

&lt;p&gt;Before the first request, and every five minutes after that, Gatekeeper runs six stages: &lt;code&gt;fetch&lt;/code&gt;, &lt;code&gt;cert-chain&lt;/code&gt;, &lt;code&gt;untrusted-root&lt;/code&gt;, &lt;code&gt;jws&lt;/code&gt;, &lt;code&gt;tls-fingerprint&lt;/code&gt;, &lt;code&gt;policy&lt;/code&gt;. Two of them do most of the work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The root of the certificate chain.&lt;/strong&gt; The root CA runs inside a confidential VM on AMD SEV-SNP or Intel TDX. Gatekeeper checks that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the hardware report is signed by the CPU vendor;&lt;/li&gt;
&lt;li&gt;the report is bound to this CA's key;&lt;/li&gt;
&lt;li&gt;the launch measurement matches one rebuilt from our published build artifacts;&lt;/li&gt;
&lt;li&gt;that measurement is signed by a Super Protocol key compiled into the Gatekeeper binary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last check is there because without it, any other tenant on the same hardware would pass. All of this runs offline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The TLS binding.&lt;/strong&gt; The signed evidence bundle includes the fingerprint of the endpoint's TLS certificate. Gatekeeper compares it with the certificate it actually saw on the same connection. If something sits between you and the server, the fingerprints won't match.&lt;/p&gt;

&lt;p&gt;If any stage fails, your app gets a 503 with an OpenAI-shaped &lt;code&gt;error&lt;/code&gt; object and a &lt;code&gt;stage&lt;/code&gt; field, and the request goes nowhere. Handle that case on its own instead of blindly retrying:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;MODEL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;msgs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;APIStatusError&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;503&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Gatekeeper refused: evidence changed or a check failed.&lt;/span&gt;
        &lt;span class="c1"&gt;# Don't fall back to an unverified endpoint.&lt;/span&gt;
        &lt;span class="nf"&gt;alert_oncall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On successful responses Gatekeeper adds an &lt;code&gt;X-Gatekeeper-Verdict: allow&lt;/code&gt; header. Log it next to the request ID in your audit trail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking it yourself, without Gatekeeper
&lt;/h2&gt;

&lt;p&gt;The evidence bundle is public and needs no key: &lt;code&gt;https://api.router.superprotocol.com/.well-known/swarm-evidence&lt;/code&gt;. The simplest thing you can verify by hand is the TLS fingerprint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;

&lt;span class="no"&gt;HOST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"api.router.superprotocol.com"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;der&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"sha256/"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;urlsafe_b64encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;der&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rstrip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="s2"&gt;"="&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;bundle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;urlopen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"https://{HOST}/.well-known/swarm-evidence"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_default_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_connection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;HOST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; \
     &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;wrap_socket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;server_hostname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HOST&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;seen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tls&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getpeercert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;binary_form&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"claimed :"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bundle&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"certFingerprint"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"observed:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"match   :"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;seen&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;bundle&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"certFingerprint"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we ran this from our own build environment, the fingerprints didn't match. All outbound traffic there goes through a TLS-inspecting proxy, so the script saw the proxy's certificate. The bundle itself was intact: the hash of its embedded &lt;code&gt;tlsLeaf&lt;/code&gt; matched the claimed fingerprint. If your corporate network does SSL inspection, Gatekeeper will deny at the &lt;code&gt;tls-fingerprint&lt;/code&gt; stage. Add the router host to your proxy's bypass list; don't loosen the check.&lt;/p&gt;

&lt;p&gt;The script is weaker than Gatekeeper: it opens two separate connections and doesn't verify the signature or the root. Use it to understand the mechanics and debug your network, not in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the check stops
&lt;/h2&gt;

&lt;p&gt;Gatekeeper proves three things: which code is running, that it's running on genuine TEE hardware, and that you're connected to it. It doesn't currently verify GPU attestation. The docs list that as out of scope, even though inference itself runs on GPUs in confidential mode. If you call &lt;code&gt;https://api.router.superprotocol.com/v1&lt;/code&gt; directly and skip Gatekeeper, nothing is verified. For tools that only accept https endpoints that's the only option, so know what you're giving up.&lt;/p&gt;

&lt;p&gt;The operator sees billing metadata only: model, token counts, timing. Each generation record (&lt;code&gt;GET /v1/generation&lt;/code&gt;) carries the &lt;code&gt;evidence_digest&lt;/code&gt; of the deployment that served it, and never any content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Back to legal
&lt;/h2&gt;

&lt;p&gt;Now the answer to legal's question isn't a pointer to the contract. The claim text is decrypted only inside an attested environment. Before every request, a process we run ourselves confirms it's the deployment we approved, and blocks the request if anything changed. The hash of that deployment sits in our log next to each call.&lt;/p&gt;

&lt;p&gt;Router access is invite-only for now: &lt;a href="https://superprotocol.com/developers/router" rel="noopener noreferrer"&gt;superprotocol.com/developers/router&lt;/a&gt;. Docs: &lt;a href="https://docs.router.superprotocol.com" rel="noopener noreferrer"&gt;docs.router.superprotocol.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>llm</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
