API Documentation
Integrate Oakhampton\'s 10 domain-specialist AI analysts into your workflows via a simple REST API. OpenAI-compatible format.
Authentication
All API requests require a Bearer token. You\'ll receive your API key when your early access is activated.
Authorization: Bearer oak_exp_your_api_key_hereKeys are prefixed with oak_exp_. Keep them secret — never expose in client-side code.
Available Experts
Select an expert by passing its model ID in the request body. Each expert is fine-tuned on domain-specific standards and frameworks.
| Model ID | Expert |
|---|---|
oak/esg | ESG & Sustainability Analyst |
oak/due-diligence | Due Diligence Researcher |
oak/supply-chain | Supply Chain Strategist |
oak/workforce | Workforce & Rostering Analyst |
oak/civil | Civil & Structural Engineer |
oak/mining | Mining Engineer |
oak/process | Mechanical & Process Engineer |
oak/electrical | Electrical & Controls Engineer |
oak/commodity | Commodity Finance Analyst |
oak/financial | Financial Modelling Analyst |
Chat Completions
The primary endpoint. OpenAI-compatible format — if you\'ve used the OpenAI SDK, you already know how this works.
curl https://api.oakhampton.ai/v1/chat/completions \
-H "Authorization: Bearer oak_exp_your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "oak/esg",
"messages": [
{
"role": "system",
"content": "You are an ESG compliance analyst."
},
{
"role": "user",
"content": "Assess CSRD double-materiality gaps for a mid-cap mining company with EU operations across E1-E5."
}
],
"temperature": 0.3,
"max_tokens": 4096
}'Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "oak/esg",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "## CSRD Double-Materiality Gap Assessment\n\n### Material Topics Identified\n\nBased on ESRS sector-specific standards for mining...\n"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 142,
"completion_tokens": 2847,
"total_tokens": 2989
}
}Parameters
| Parameter | Type | Description |
|---|---|---|
model | string | Required. Expert model ID (e.g. "oak/esg") |
messages | array | Required. Conversation history in OpenAI format |
temperature | float | Optional. 0.0–1.0, default 0.3. Lower = more precise |
max_tokens | integer | Optional. Max response length, default 4096 |
stream | boolean | Optional. Enable SSE streaming, default false |
context_files | array | Optional. File IDs to include as context |
Streaming
Pass "stream": true to receive Server-Sent Events. Each event is a JSON chunk matching the OpenAI streaming format.
curl https://api.oakhampton.ai/v1/chat/completions \
-H "Authorization: Bearer oak_exp_your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "oak/mining",
"messages": [{"role": "user", "content": "Review this TSF design against GISTM requirements."}],
"stream": true
}'data: {"choices":[{"delta":{"content":"## GISTM"}}]}
data: {"choices":[{"delta":{"content":" Compliance"}}]}
data: {"choices":[{"delta":{"content":" Review\n"}}]}
...
data: [DONE]File Uploads
Upload documents (PDF, DOCX, XLSX, CSV) to provide context for your queries. Files are scoped to your API key and auto-deleted after 24 hours.
curl https://api.oakhampton.ai/v1/files \
-H "Authorization: Bearer oak_exp_your_key" \
-F "file=@tailings_report.pdf" \
-F "purpose=context"{
"id": "file-abc123",
"filename": "tailings_report.pdf",
"bytes": 2456789,
"created_at": 1717171717
}Reference file IDs in context_files when making chat completions. Max 10 files, 50MB each.
Rate Limits & Billing
| Plan | Rate Limit | Billing | Context Window |
|---|---|---|---|
| Pay-as-you-go | 10 req/min | Metered per query ($1–$15) | 32K tokens |
| Pro | 60 req/min | $499/mo included allowance | 128K tokens |
| Enterprise | Custom | $2,499/mo unlimited | 128K tokens |
Query cost depends on complexity: simple lookups ~$1, detailed analyses with file context ~$5–$15. Usage dashboard available at dashboard.oakhampton.ai.
Error Handling
Standard HTTP status codes with JSON error bodies.
| Code | Meaning |
|---|---|
400 | Bad request — check parameters |
401 | Invalid or missing API key |
403 | Key doesn't have access to this expert |
429 | Rate limit exceeded — retry after delay |
500 | Server error — contact support |
{
"error": {
"message": "Rate limit exceeded. Retry after 12 seconds.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}SDK & Libraries
Since the API is OpenAI-compatible, you can use the official OpenAI SDK with a custom base URL:
from openai import OpenAI
client = OpenAI(
api_key="oak_exp_your_key",
base_url="https://api.oakhampton.ai/v1"
)
response = client.chat.completions.create(
model="oak/esg",
messages=[
{"role": "user", "content": "Assess our CSRD readiness for ESRS E1-E5."}
],
temperature=0.3
)
print(response.choices[0].message.content)import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'oak_exp_your_key',
baseURL: 'https://api.oakhampton.ai/v1',
});
const response = await client.chat.completions.create({
model: 'oak/mining',
messages: [
{ role: 'user', content: 'Review this TSF against GISTM requirements.' }
],
});
console.log(response.choices[0].message.content);Ready to integrate?
Sign up for early access and we\'ll provision your API key as soon as the platform goes live.
Request Early Access