Azure OpenAI Integration
KoreShield can proxy Azure OpenAI requests to apply sanitization, detection, and policy enforcement before requests reach your Azure endpoint.
Model Names
In Azure OpenAI, the model field usually maps to your deployment name, not the base model name.
Basic Request (TypeScript)
const response = await fetch("http://localhost:8000/v1/chat/completions", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
model: "gpt-4o",
messages: [{ role: "user", content: "Summarize the ticket backlog." }]
})
});
Basic Request (Python)
import requests
response = requests.post(
"http://localhost:8000/v1/chat/completions",
json={
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Summarize the ticket backlog."}]
}
)
Streaming
const response = await fetch("http://localhost:8000/v1/chat/completions", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
model: "gpt-4o",
stream: true,
messages: [{ role: "user", content: "Write an executive summary." }]
})
});
response = requests.post(
"http://localhost:8000/v1/chat/completions",
json={
"model": "gpt-4o",
"stream": True,
"messages": [{"role": "user", "content": "Write an executive summary."}]
},
stream=True
)
for line in response.iter_lines():
if line:
print(line.decode("utf-8"))
System Prompts and Multi-Turn
{
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a support analyst."},
{"role": "user", "content": "Summarize the backlog."},
{"role": "assistant", "content": "Summary..."},
{"role": "user", "content": "Highlight top risks."}
]
}
payload = {
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a support analyst."},
{"role": "user", "content": "Summarize the backlog."},
{"role": "assistant", "content": "Summary..."},
{"role": "user", "content": "Highlight top risks."}
]
}
Error Handling
403indicates a blocked request due to policy enforcement.429or5xxtypically indicates provider or rate-limit issues.
Security Controls
security:
sensitivity: medium
default_action: block
features:
sanitization: true
detection: true
policy_enforcement: true
Next Steps
- Configure providers in /configuration/
- See SDK usage in https://github.com/koreshield/node-sdk