Quickstart
Send your first request in a few minutes. The API speaks the OpenAI chat completions format, so the OpenAI SDKs work once you change the base URL.
1. Create an API key
Keys authenticate every request. Create one in the console and copy it right away: the full key is shown once. New keys can chat and use the knowledge base; turn on billing permissions only for keys that need them.
2. Keep the key out of your code
Store the key in an environment variable or a secret manager. Never ship it in browser or mobile code.
export COUNCIL_API_KEY="cai_live_..."3. Install an SDK
The API accepts the OpenAI chat completions format, so the official OpenAI SDKs work as they are. You only change the base URL.
Python
pip install openaiNode.js
npm install openaicurl
curl --version4. Send a request
Point the client at https://developer.council.health/v1 and call chat completions.
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://developer.council.health/v1",
api_key=os.environ["COUNCIL_API_KEY"],
)
response = client.chat.completions.create(
model="YOUR_MODEL_ID", # GET /v1/models lists yours
messages=[{"role": "user", "content": "Summarize first line treatment for hypertension."}],
)
print(response.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://developer.council.health/v1",
apiKey: process.env.COUNCIL_API_KEY,
});
const response = await client.chat.completions.create({
model: "YOUR_MODEL_ID", // GET /v1/models lists yours
messages: [{ role: "user", content: "Summarize first line treatment for hypertension." }],
});
console.log(response.choices[0].message.content);curl
curl https://developer.council.health/v1/chat/completions \
-H "Authorization: Bearer $COUNCIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [{ "role": "user", "content": "Summarize first line treatment for hypertension." }]
}'5. Read the response
Responses follow the OpenAI shape, including token usage when the model reports it. The console shows requests and spend on the Usage page.
{
"id": "chatcmpl_...",
"object": "chat.completion",
"model": "YOUR_MODEL_ID",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Guidelines recommend lifestyle changes for everyone with high blood pressure..."
},
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 18, "completion_tokens": 96, "total_tokens": 114 }
}Sample response for illustration. Not medical advice.
