OpenAI-compatible examples
ScaleMax works with the standard OpenAI SDK pattern. Set SCALEMAX_BASE_URL to https://api.scalemax.pro/v1 for API credit or https://api.scalemax.pro/token/v1 for an API-token key. Choose an exact model ID returned by that key's authenticated catalog.
bash
# API-credit key:
export SCALEMAX_BASE_URL="https://api.scalemax.pro/v1"
# API-token key:
# export SCALEMAX_BASE_URL="https://api.scalemax.pro/token/v1"powershell
# API-credit key:
$env:SCALEMAX_BASE_URL = "https://api.scalemax.pro/v1"
# API-token key:
# $env:SCALEMAX_BASE_URL = "https://api.scalemax.pro/token/v1"SDK examples
Node SDK
bash
npm install openaipowershell
npm.cmd install openaiWindows PowerShell blocks npm’s .ps1 launchers by default (“running scripts is disabled on this system”), so these commands use the .cmd launcher: npx.cmd, npm.cmd, scalemax.cmd. In Command Prompt you can leave out .cmd.
client.ts
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.SCALEMAX_API_KEY,
baseURL: process.env.SCALEMAX_BASE_URL,
});
const completion = await client.chat.completions.create({
model: "YOUR_AUTHENTICATED_MODEL_ID",
messages: [{ role: "user", content: "Say hello from ScaleMax." }],
});
console.log(completion.choices[0]?.message?.content);Python SDK
bash
pip install openaiclient.py
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["SCALEMAX_API_KEY"],
base_url=os.environ["SCALEMAX_BASE_URL"],
)
completion = client.chat.completions.create(
model="YOUR_AUTHENTICATED_MODEL_ID",
messages=[{"role": "user", "content": "Say hello from ScaleMax."}],
)
print(completion.choices[0].message.content)cURL
request.sh
export SCALEMAX_AUTH_HEADER="Authorization: Bearer $SCALEMAX_API_KEY"
curl "$SCALEMAX_BASE_URL/chat/completions" \
-H "$SCALEMAX_AUTH_HEADER" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_AUTHENTICATED_MODEL_ID",
"messages": [{"role": "user", "content": "Say hello from ScaleMax."}]
}'request.ps1
$env:SCALEMAX_AUTH_HEADER = "Authorization: Bearer $env:SCALEMAX_API_KEY"
@'
{
"model": "YOUR_AUTHENTICATED_MODEL_ID",
"messages": [{"role": "user", "content": "Say hello from ScaleMax."}]
}
'@ | Set-Content -Path body.json
curl.exe "$env:SCALEMAX_BASE_URL/chat/completions" `
-H "$env:SCALEMAX_AUTH_HEADER" `
-H "Content-Type: application/json" `
--data-binary "@body.json"PowerShell changes quotes inside a JSON argument, so the request body goes into body.json first and curl.exe sends that file. Type curl.exe, not curl: in Windows PowerShell 5.1, curl is a different command.
Client setup examples
For supported coding clients, the recommended setup is the globally installed scalemax CLI. The snippets below document the manual fallback shape.
Codex
bash
# Recommended
npm install -g scalemax
scalemax
# Manual Codex provider config is documented at:
# https://docs.scalemax.pro/docs/manual-configuration/codexpowershell
# Recommended
npm.cmd install -g scalemax
scalemax.cmd
# Manual Codex provider config is documented at:
# https://docs.scalemax.pro/docs/manual-configuration/codexWindows PowerShell blocks npm’s .ps1 launchers by default (“running scripts is disabled on this system”), so these commands use the .cmd launcher: npx.cmd, npm.cmd, scalemax.cmd. In Command Prompt you can leave out .cmd.
Cursor
settings.json
{
"openai.baseURL": "YOUR_SCALEMAX_BASE_URL",
"openai.apiKey": "your-scale-max-key"
}OpenCode
config.json
{
"client": "OpenCode",
"provider": "openai-compatible",
"baseURL": "YOUR_SCALEMAX_BASE_URL",
"apiKey": "your-scale-max-key"
}Full per-client walkthroughs live in the manual configuration guides. For language-specific pages, see Python, JavaScript, and cURL; for the field-by-field contract, see OpenAI compatibility.