Get API key

Quickstart

Make your first PrivateMind API request in five minutes.

Set two environment variables and you're done.

1. Get an API key

Sign in to PrivateMind, open Settings → API Keys, and click Create key. Give it a name, set a budget cap, and copy the secret immediately. It isn't shown again.

Keys are split into two parts:

Text
PMIND...:...

The part before the colon is the ID (starts with PMIND), and the part after is the secret. The full string, both halves together, is the bearer token.

2. Set your key

The rest of this site uses https://api.privatemind.com as the base URL.

cURL
export PMIND_KEY='PMIND...:...'

3. List models

cURL
curl -s "https://api.privatemind.com/v1/models" \
  -H "Authorization: Bearer $PMIND_KEY" \
  | jq '.data[] | {id, context_length, supported_parameters}'

The list reflects what's actually deployed and what your org can call. Pick a model id for the next step.

4. Make a chat completion

curl -s "https://api.privatemind.com/v1/chat/completions" \
  -H "Authorization: Bearer $PMIND_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "fast",
    "messages": [{"role": "user", "content": "Summarise CAP theorem in one sentence."}]
  }'
from openai import OpenAI

client = OpenAI(base_url="https://api.privatemind.com/v1", api_key=PMIND_KEY)
resp = client.chat.completions.create(
    model="fast",
    messages=[{"role": "user", "content": "Summarise CAP theorem in one sentence."}],
)
print(resp.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: `https://api.privatemind.com/v1`,
  apiKey: process.env.PMIND_KEY,
});
const resp = await client.chat.completions.create({
  model: 'fast',
  messages: [{ role: 'user', content: 'Summarise CAP theorem in one sentence.' }],
});
console.log(resp.choices[0].message.content);

Response is the standard OpenAI chat.completion envelope: choices[0].message.content plus a usage block.

Where next