# API Code

> Configure custom API code for ScaleMax Chat Completions, Responses, or Anthropic Messages using secure server-side credentials.

## Connection settings

- **Provider:** OpenAI Compatible / Custom OpenAI provider
- **API-credit base URL:** `https://api.scalemax.pro/v1`
- **API-token base URL:** `https://api.scalemax.pro/token/v1`
- **API key:** your full ScaleMax key
- **Model:** an exact ID returned by the authenticated `/models` endpoint (for example, `fable-5` for a Claude-capable or both-scope key)

Use the URL that belongs to the key. API-credit and API-token keys deliberately return an authentication failure on the other billing surface. The examples below use `SCALEMAX_BASE_URL` so the same code works for either key type.

Fable 5 is an Anthropic-family frontend model. It can use this normalized Chat Completions shape, but never appears for an OpenAI-only key. A Claude token key can use the same request shape on `https://api.scalemax.pro/token/v1`, selecting only an ID returned for that key. Native Anthropic clients use the origin-only token URL `https://api.scalemax.pro/token`; use the [Claude Code guide](https://docs.scalemax.pro/docs/manual-configuration/claude-code) or [Claude Desktop guide](https://docs.scalemax.pro/docs/manual-configuration/claude-desktop).

## Models

- `fable-5`
- `gpt-6.1-sol`
- `gpt-6-sol`
- `gpt-6-luna`
- `gpt-6-astra`
- `gpt-5.6-terra`
- `gpt-5.6-sol`
- `gpt-5.6-luna`

## Node example

```ts
import OpenAI from 'openai';
const client = new OpenAI({
  apiKey: process.env.SCALEMAX_API_KEY,
  baseURL: process.env.SCALEMAX_BASE_URL
});
```

## Automatic setup

**macOS / Linux**

```bash
npm install -g scalemax@latest
scalemax
```

**Windows PowerShell**

```powershell
npm.cmd install -g scalemax@latest
scalemax.cmd
```

Windows 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.

The CLI writes examples with the base URL detected from the key. For apps that only expose UI settings, it writes a setup guide under `~/.scalemax/`.
