<?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: Ridwan Zunaid</title>
    <description>The latest articles on DEV Community by Ridwan Zunaid (@ridwan_zunaid_40c272be561).</description>
    <link>https://dev.to/ridwan_zunaid_40c272be561</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%2F4229513%2F43a8db26-409f-48e4-af64-612e584914e3.jpg</url>
      <title>DEV Community: Ridwan Zunaid</title>
      <link>https://dev.to/ridwan_zunaid_40c272be561</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ridwan_zunaid_40c272be561"/>
    <language>en</language>
    <item>
      <title>Building a Medical Investigation AI on an OpenAI-Compatible API</title>
      <dc:creator>Ridwan Zunaid</dc:creator>
      <pubDate>Fri, 06 Nov 2026 07:12:00 +0000</pubDate>
      <link>https://dev.to/ridwan_zunaid_40c272be561/building-a-medical-investigation-ai-on-an-openai-compatible-api-1cfe</link>
      <guid>https://dev.to/ridwan_zunaid_40c272be561/building-a-medical-investigation-ai-on-an-openai-compatible-api-1cfe</guid>
      <description>&lt;p&gt;November 6, 2026 | 8 min read&lt;/p&gt;

&lt;p&gt;Most medical AI demos are a chat box with a medical prompt.&lt;/p&gt;

&lt;p&gt;You send a symptom. You get a paragraph. It can look impressive in a screenshot. Then you try to use it on a real case and discover the hard parts: the record is fragmented, the values have dates, the medications interact, the evidence needs a source, and the model has no idea what it does not know.&lt;/p&gt;

&lt;p&gt;Premedice is a medical investigation AI. The product is built around a different unit of work: the whole case, not the single question.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmztlcsfpx63lmkf106bl.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmztlcsfpx63lmkf106bl.jpeg" alt=" " width="800" height="479"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This post is a technical look at how that works, and how to call the API from your own stack.&lt;/p&gt;

&lt;p&gt;THE PROBLEM WITH A SINGLE PROMPT&lt;/p&gt;

&lt;p&gt;A standard medical RAG pipeline retrieves a few passages and asks a model to answer. That is useful for general questions. It is not enough for an investigation.&lt;/p&gt;

&lt;p&gt;An investigation needs four things a single retrieval call usually lacks.&lt;/p&gt;

&lt;p&gt;Temporal context. A potassium of 5.3 means something different if it was 4.1 last month. A medication started nine days ago matters. A lab trend matters. A snapshot does not.&lt;/p&gt;

&lt;p&gt;Tool access. The answer may depend on a drug label, an interaction database, a clinical trial, or a guideline. Retrieval alone does not check those sources.&lt;/p&gt;

&lt;p&gt;A citation trail. A high-stakes claim without a source is a hypothesis. The user needs to inspect the basis, not just read the conclusion.&lt;/p&gt;

&lt;p&gt;Explicit uncertainty. A good investigation names the gaps. What is missing? Which value conflicts? Which symptom has no explanation yet?&lt;/p&gt;

&lt;p&gt;That is the design brief for a medical investigation AI.&lt;/p&gt;

&lt;p&gt;WHAT "MEDICAL INVESTIGATION AI" MEANS&lt;/p&gt;

&lt;p&gt;Medical investigation AI is software that takes a health question and investigates it across the full available record, rather than generating an answer from a single prompt.&lt;/p&gt;

&lt;p&gt;It collects the history, labs, medications, documents, and symptoms. It correlates changes over time. It verifies claims against literature and drug sources. It states what is missing. Then it returns a structured brief for a human to review.&lt;/p&gt;

&lt;p&gt;Premedice is built for that job. It is not a diagnosis engine. It is an investigation layer that sits between the record and the clinician.&lt;/p&gt;

&lt;p&gt;THE ARCHITECTURE, IN PRACTICAL TERMS&lt;/p&gt;

&lt;p&gt;Premedice exposes an OpenAI-compatible endpoint. If you already use the OpenAI SDK, you change the base URL, the API key, and the model name. The rest of your client code stays the same.&lt;/p&gt;

&lt;p&gt;Base URL: &lt;a href="https://api.premedice.com/v1" rel="noopener noreferrer"&gt;https://api.premedice.com/v1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Model: Premedice/Premed-4&lt;/p&gt;

&lt;p&gt;Context window: 128K tokens&lt;/p&gt;

&lt;p&gt;Max output: 16K tokens&lt;/p&gt;

&lt;p&gt;Streaming: OpenAI SSE&lt;/p&gt;

&lt;p&gt;Tools: eight medical tools are preloaded on every request. PubMed, OpenFDA, RxNorm, DailyMed, ClinicalTrials.gov, Semantic Scholar, Europe PMC, and create_file.&lt;/p&gt;

&lt;p&gt;The tools are always on. That is a deliberate product decision. A medical investigation should not require the caller to remember which database to attach. The model should be able to check the label, the interaction, the trial, and the literature as part of the investigation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq1algt5h83aol7yzba8p.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq1algt5h83aol7yzba8p.jpeg" alt=" " width="800" height="479"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The response includes the answer and its sources. The exact shape is the normal chat completion shape, so existing streaming, retries, and logging code should carry over.&lt;/p&gt;

&lt;p&gt;WHAT A GOOD RESPONSE SHOULD CONTAIN&lt;/p&gt;

&lt;p&gt;A medical investigation AI should return more than a paragraph. A useful brief has five parts.&lt;/p&gt;

&lt;p&gt;The signals. The values or findings that changed and deserve attention.&lt;/p&gt;

&lt;p&gt;The evidence. The source value, trend, guideline, label, or paper behind each signal. The reader should be able to check it.&lt;/p&gt;

&lt;p&gt;The correlations. The medication, condition, or history that may explain the signal. Correlation is not causation, and the brief should say so.&lt;/p&gt;

&lt;p&gt;The gaps. The missing history, the conflicting value, the symptom that has no explanation yet.&lt;/p&gt;

&lt;p&gt;The boundary. A clear statement that the output is decision support, not a diagnosis, and that urgent symptoms need urgent care.&lt;/p&gt;

&lt;p&gt;If your medical AI output does not have those five parts, it is probably a chat response, not an investigation.&lt;/p&gt;

&lt;p&gt;DESIGN LESSONS&lt;/p&gt;

&lt;p&gt;Three lessons shaped the product.&lt;/p&gt;

&lt;p&gt;Preload the tools. A medical investigation should not fail because the caller did not attach the right database. The tools are part of the investigation environment, not an optional plugin.&lt;/p&gt;

&lt;p&gt;Make citations first-class. A citation is not a footnote added after the fact. It is part of the answer. If a high-stakes claim cannot be tied to a source, the claim should be marked as uncertain.&lt;/p&gt;

&lt;p&gt;Keep the uncertainty visible. Models are good at sounding complete. A medical investigation AI has to be good at sounding incomplete when the evidence is incomplete. That is a product behavior, not just a prompt.&lt;/p&gt;

&lt;p&gt;The model matters too, but it is not the whole product. Premedice 4 scored 84.6 percent on an internal MedQA replication. That is an exam-style benchmark, not a clinical validation or an outcome study. It has not been peer-reviewed. It is a signal about reasoning, not proof of accuracy in a real patient.&lt;/p&gt;

&lt;p&gt;Benchmarks are a floor, not a finish line.&lt;/p&gt;

&lt;p&gt;WHAT TO BUILD WITH IT&lt;/p&gt;

&lt;p&gt;The API is useful anywhere a developer needs a cited medical investigation rather than a generic answer.&lt;/p&gt;

&lt;p&gt;Patient education tools that explain labs in plain language and show the source.&lt;/p&gt;

&lt;p&gt;Clinical preparation tools that assemble a pre-visit brief from a record.&lt;/p&gt;

&lt;p&gt;Research prototypes that need to correlate labs, medications, and literature.&lt;/p&gt;

&lt;p&gt;Caregiver tools that help someone organize a family member's records and questions.&lt;/p&gt;

&lt;p&gt;Second-opinion workflows that review the whole case against the evidence.&lt;/p&gt;

&lt;p&gt;The API is not a diagnosis engine. It is not a telehealth service. It is not an emergency service. It is a reasoning and evidence layer that a human should review.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff8ovzue2wruxlr2s2fve.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff8ovzue2wruxlr2s2fve.jpeg" alt=" " width="800" height="479"&gt;&lt;/a&gt;&lt;br&gt;
SAFETY AND PRIVACY FOR DEVELOPERS&lt;/p&gt;

&lt;p&gt;If you are building in health, the non-negotiables are not optional.&lt;/p&gt;

&lt;p&gt;Use a lawful basis for processing. Do not send identifiable data without consent or another valid legal basis.&lt;/p&gt;

&lt;p&gt;Keep API keys server-side. A pm_live key is a secret. Do not ship it in a client bundle.&lt;/p&gt;

&lt;p&gt;Log carefully. Do not store full patient records in application logs or error trackers.&lt;/p&gt;

&lt;p&gt;Respect the boundary. Do not present the output as a diagnosis. Do not use it for emergency triage.&lt;/p&gt;

&lt;p&gt;Check the data flow. Premedice is designed around GDPR-native, EU-resident data handling, with AES-256 at rest and TLS 1.3 in transit. User data is not used for model training. The API is a developer surface, but your application still needs its own privacy review.&lt;/p&gt;

&lt;p&gt;For a clinical deployment, a clinic still needs a data protection impact assessment, a retention policy, a clinical safety review, and a clear escalation path.&lt;/p&gt;

&lt;p&gt;PRICING AND ACCESS&lt;/p&gt;

&lt;p&gt;API keys are generated in the Premedice dashboard. Billing uses the same per-token rates as the in-app chat and is debited from the account's token balance.&lt;/p&gt;

&lt;p&gt;The app itself has a free tier. Pro is 5.99 EUR per month, and Advanced is 20 EUR per month. The API is the developer path for teams that want to integrate the investigation into their own product.&lt;/p&gt;

&lt;p&gt;GETTING STARTED&lt;/p&gt;

&lt;p&gt;Read the API docs at api.premedice.com/docs.&lt;/p&gt;

&lt;p&gt;Create a key in the Premedice dashboard.&lt;/p&gt;

&lt;p&gt;Point your OpenAI SDK at &lt;a href="https://api.premedice.com/v1" rel="noopener noreferrer"&gt;https://api.premedice.com/v1&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Use the model name Premedice/Premed-4.&lt;/p&gt;

&lt;p&gt;Send a synthetic case first. Check the citations. Check the uncertainty. Then decide whether the output is good enough for your workflow.&lt;/p&gt;

&lt;p&gt;KEY TAKEAWAYS&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Medical investigation AI is a whole-record, tool-using, cited workflow. It is not a single-prompt chatbot.&lt;/li&gt;
&lt;li&gt;Premedice exposes an OpenAI-compatible endpoint with a 128K context window and eight preloaded medical tools.&lt;/li&gt;
&lt;li&gt;Citations and explicit uncertainty are product requirements, not prompt decoration.&lt;/li&gt;
&lt;li&gt;Premedice 4's 84.6 percent MedQA replication is an internal, non-peer-reviewed benchmark, not clinical validation.&lt;/li&gt;
&lt;li&gt;The API is decision support. A human remains accountable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0b84amxm15mick0k6lwo.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0b84amxm15mick0k6lwo.jpeg" alt=" " width="800" height="479"&gt;&lt;/a&gt;&lt;br&gt;
FAQ&lt;/p&gt;

&lt;p&gt;Is the API OpenAI-compatible?&lt;br&gt;
Yes. Use the base URL &lt;a href="https://api.premedice.com/v1" rel="noopener noreferrer"&gt;https://api.premedice.com/v1&lt;/a&gt;, your Premedice key, and the model Premedice/Premed-4.&lt;/p&gt;

&lt;p&gt;Which tools are preloaded?&lt;br&gt;
PubMed, OpenFDA, RxNorm, DailyMed, ClinicalTrials.gov, Semantic Scholar, Europe PMC, and create_file. They are on by default.&lt;/p&gt;

&lt;p&gt;Does the API diagnose patients?&lt;br&gt;
No. It is decision support. It does not diagnose, prescribe, or replace a clinician.&lt;/p&gt;

&lt;p&gt;Is patient data used for training?&lt;br&gt;
No. Premedice states that user data is not used for model training.&lt;/p&gt;

&lt;p&gt;Where are the docs?&lt;br&gt;
&lt;a href="https://api.premedice.com/docs" rel="noopener noreferrer"&gt;https://api.premedice.com/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SOURCES&lt;/p&gt;

&lt;p&gt;Premedice 4 model page.&lt;br&gt;
&lt;a href="https://premedice.com/models/premedice-4/" rel="noopener noreferrer"&gt;https://premedice.com/models/premedice-4/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Premedice API documentation.&lt;br&gt;
&lt;a href="https://api.premedice.com/docs" rel="noopener noreferrer"&gt;https://api.premedice.com/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jin D, et al. What Disease Does This Patient Have? A Large-Scale Open Domain Question Answering Dataset from Medical Exams. arXiv:2009.13081.&lt;br&gt;
&lt;a href="https://arxiv.org/abs/2009.13081" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2009.13081&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;World Health Organization. Patient safety.&lt;br&gt;
&lt;a href="https://www.who.int/news-room/fact-sheets/detail/patient-safety" rel="noopener noreferrer"&gt;https://www.who.int/news-room/fact-sheets/detail/patient-safety&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;COVER IMAGE&lt;/p&gt;

&lt;p&gt;Ready to use: &lt;a href="https://premedice.com/og-home.jpg" rel="noopener noreferrer"&gt;https://premedice.com/og-home.jpg&lt;/a&gt; (1200 x 630)&lt;br&gt;
Alt text: Premedice medical investigation AI product preview with a cited answer interface.&lt;/p&gt;

&lt;p&gt;Custom cover direction: a terminal window beside a lab report, with three values highlighted and a source list on the right. No stock photos, no robot hands, no blue-purple gradient.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>medical</category>
      <category>healthtech</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
