Back to AI Experts

API Documentation

Integrate Oakhampton\'s 10 domain-specialist AI analysts into your workflows via a simple REST API. OpenAI-compatible format.

Coming SoonBase URL: api.oakhampton.ai/v1

Authentication

All API requests require a Bearer token. You\'ll receive your API key when your early access is activated.

Header
Authorization: Bearer oak_exp_your_api_key_here

Keys 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 IDExpert
oak/esgESG & Sustainability Analyst
oak/due-diligenceDue Diligence Researcher
oak/supply-chainSupply Chain Strategist
oak/workforceWorkforce & Rostering Analyst
oak/civilCivil & Structural Engineer
oak/miningMining Engineer
oak/processMechanical & Process Engineer
oak/electricalElectrical & Controls Engineer
oak/commodityCommodity Finance Analyst
oak/financialFinancial Modelling Analyst

Chat Completions

The primary endpoint. OpenAI-compatible format — if you\'ve used the OpenAI SDK, you already know how this works.

POST /v1/chat/completions
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

200 OK
{
  "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

ParameterTypeDescription
modelstringRequired. Expert model ID (e.g. "oak/esg")
messagesarrayRequired. Conversation history in OpenAI format
temperaturefloatOptional. 0.0–1.0, default 0.3. Lower = more precise
max_tokensintegerOptional. Max response length, default 4096
streambooleanOptional. Enable SSE streaming, default false
context_filesarrayOptional. 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.

Streaming request
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
  }'
Event stream
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.

POST /v1/files
curl https://api.oakhampton.ai/v1/files \
  -H "Authorization: Bearer oak_exp_your_key" \
  -F "file=@tailings_report.pdf" \
  -F "purpose=context"
Response
{
  "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

PlanRate LimitBillingContext Window
Pay-as-you-go10 req/minMetered per query ($1–$15)32K tokens
Pro60 req/min$499/mo included allowance128K tokens
EnterpriseCustom$2,499/mo unlimited128K 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.

CodeMeaning
400Bad request — check parameters
401Invalid or missing API key
403Key doesn't have access to this expert
429Rate limit exceeded — retry after delay
500Server error — contact support
Error response
{
  "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:

Python
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)
JavaScript / TypeScript
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