Building a Medical Investigation AI on an OpenAI-Compatible API Premedice, a medical investigation AI, has been built on an OpenAI-compatible API endpoint that lets developers swap in its base URL, API key, and Premed-4 model without changing existing client code. The system runs a 128K-token context window with eight always-on medical tools — including PubMed, OpenFDA, RxNorm, DailyMed, ClinicalTrials.gov, Semantic Scholar, and Europe PMC — and returns structured briefs covering signals, evidence, correlations, gaps, and a decision-support boundary rather than single-prompt answers. November 6, 2026 | 8 min read Most medical AI demos are a chat box with a medical prompt. 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. Premedice is a medical investigation AI. The product is built around a different unit of work: the whole case, not the single question. This post is a technical look at how that works, and how to call the API from your own stack. THE PROBLEM WITH A SINGLE PROMPT 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. An investigation needs four things a single retrieval call usually lacks. 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. 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. 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. Explicit uncertainty. A good investigation names the gaps. What is missing? Which value conflicts? Which symptom has no explanation yet? That is the design brief for a medical investigation AI. WHAT "MEDICAL INVESTIGATION AI" MEANS 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. 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. 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. THE ARCHITECTURE, IN PRACTICAL TERMS 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. Base URL: https://api.premedice.com/v1 https://api.premedice.com/v1 Model: Premedice/Premed-4 Context window: 128K tokens Max output: 16K tokens Streaming: OpenAI SSE Tools: eight medical tools are preloaded on every request. PubMed, OpenFDA, RxNorm, DailyMed, ClinicalTrials.gov, Semantic Scholar, Europe PMC, and create file. 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. 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. WHAT A GOOD RESPONSE SHOULD CONTAIN A medical investigation AI should return more than a paragraph. A useful brief has five parts. The signals. The values or findings that changed and deserve attention. The evidence. The source value, trend, guideline, label, or paper behind each signal. The reader should be able to check it. The correlations. The medication, condition, or history that may explain the signal. Correlation is not causation, and the brief should say so. The gaps. The missing history, the conflicting value, the symptom that has no explanation yet. The boundary. A clear statement that the output is decision support, not a diagnosis, and that urgent symptoms need urgent care. If your medical AI output does not have those five parts, it is probably a chat response, not an investigation. DESIGN LESSONS Three lessons shaped the product. 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. 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. 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. 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. Benchmarks are a floor, not a finish line. WHAT TO BUILD WITH IT The API is useful anywhere a developer needs a cited medical investigation rather than a generic answer. Patient education tools that explain labs in plain language and show the source. Clinical preparation tools that assemble a pre-visit brief from a record. Research prototypes that need to correlate labs, medications, and literature. Caregiver tools that help someone organize a family member's records and questions. Second-opinion workflows that review the whole case against the evidence. 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. SAFETY AND PRIVACY FOR DEVELOPERS If you are building in health, the non-negotiables are not optional. Use a lawful basis for processing. Do not send identifiable data without consent or another valid legal basis. Keep API keys server-side. A pm live key is a secret. Do not ship it in a client bundle. Log carefully. Do not store full patient records in application logs or error trackers. Respect the boundary. Do not present the output as a diagnosis. Do not use it for emergency triage. 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. 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. PRICING AND ACCESS 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. 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. GETTING STARTED Read the API docs at api.premedice.com/docs. Create a key in the Premedice dashboard. Point your OpenAI SDK at https://api.premedice.com/v1 https://api.premedice.com/v1 . Use the model name Premedice/Premed-4. Send a synthetic case first. Check the citations. Check the uncertainty. Then decide whether the output is good enough for your workflow. KEY TAKEAWAYS Is the API OpenAI-compatible? Yes. Use the base URL https://api.premedice.com/v1 https://api.premedice.com/v1 , your Premedice key, and the model Premedice/Premed-4. Which tools are preloaded? PubMed, OpenFDA, RxNorm, DailyMed, ClinicalTrials.gov, Semantic Scholar, Europe PMC, and create file. They are on by default. Does the API diagnose patients? No. It is decision support. It does not diagnose, prescribe, or replace a clinician. Is patient data used for training? No. Premedice states that user data is not used for model training. Where are the docs? https://api.premedice.com/docs https://api.premedice.com/docs SOURCES Premedice 4 model page. https://premedice.com/models/premedice-4/ https://premedice.com/models/premedice-4/ Premedice API documentation. https://api.premedice.com/docs https://api.premedice.com/docs Jin D, et al. What Disease Does This Patient Have? A Large-Scale Open Domain Question Answering Dataset from Medical Exams. arXiv:2009.13081. https://arxiv.org/abs/2009.13081 https://arxiv.org/abs/2009.13081 World Health Organization. Patient safety. https://www.who.int/news-room/fact-sheets/detail/patient-safety https://www.who.int/news-room/fact-sheets/detail/patient-safety COVER IMAGE Ready to use: https://premedice.com/og-home.jpg https://premedice.com/og-home.jpg 1200 x 630 Alt text: Premedice medical investigation AI product preview with a cited answer interface. 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.