Skip to main content

OpenAI

Connect Scrub AI to OpenAI to use GPT-5 and other OpenAI models with PHI protection.

Setup

  1. Get an OpenAI API key from platform.openai.com
  2. Log in to your Scrub AI Dashboard
  3. Go to Providers and select OpenAI
  4. Paste your API key and save

Available Models

ModelDescription
gpt-5.2The best model for coding and agentic tasks across industries
gpt-5-miniA faster, cost-efficient version of GPT-5 for well-defined tasks
gpt-5-nanoFastest, most cost-efficient version of GPT-5
gpt-5.2-proPremium GPT-5.2 with enhanced capabilities
gpt-5.2.1-2025-04-14Smartest non-reasoning model

Example Request

curl https://api.scrub.health/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $SCRUB_API_KEY" \
-d '{
"model": "gpt-5.2",
"messages": [
{"role": "system", "content": "You are a helpful healthcare assistant."},
{"role": "user", "content": "What are the symptoms of hypertension?"}
],
"temperature": 0.7
}'

Using the OpenAI SDK

Since Scrub AI is OpenAI-compatible, you can use the official OpenAI SDK by changing the base URL:

from openai import OpenAI

client = OpenAI(
api_key="your_scrub_api_key",
base_url="https://api.scrub.health/v1"
)

response = client.chat.completions.create(
model="gpt-5.2",
messages=[
{"role": "user", "content": "Hello!"}
]
)

print(response.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
apiKey: process.env.SCRUB_API_KEY,
baseURL: 'https://api.scrub.health/v1',
});

const response = await client.chat.completions.create({
model: 'gpt-5.2',
messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.choices[0].message.content);

Supported Parameters

Scrub AI passes through all standard OpenAI parameters:

  • temperature
  • max_tokens
  • top_p
  • frequency_penalty
  • presence_penalty
  • stop
  • stream
  • n

Streaming

Streaming is fully supported:

stream = client.chat.completions.create(
model="gpt-5.2",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True
)

for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")