# OpenAI Compatibility

> Understand ScaleMax OpenAI-compatible Chat Completions and Responses endpoints, supported fields, base URLs, and client limitations.

ScaleMax implements the documented OpenAI-compatible endpoint subset, not every endpoint or vendor-specific behavior in the OpenAI platform. Clients that use the supported routes can connect by changing the `base_url`.

## Use the matching OpenAI-compatible base URL

- **API-credit key:** `https://api.scalemax.pro/v1`
- **API-token key:** `https://api.scalemax.pro/token/v1`

These are the two OpenAI-compatible surfaces. A Claude token key can use the token `/v1` route only when the client uses an OpenAI-compatible adapter, and it must select a Claude model returned by that key's catalog. Native Anthropic Messages clients use an origin with no `/v1`; see [Claude Code](https://docs.scalemax.pro/docs/manual-configuration/claude-code) or [Claude Desktop](https://docs.scalemax.pro/docs/manual-configuration/claude-desktop).

## What's compatible

| OpenAI feature | Supported on ScaleMax | Notes |
| --- | --- | --- |
| Chat completions (request/response shape) | ✅ | OpenAI-compatible shape on the documented `/chat/completions` route; model capabilities can differ. |
| Streaming (SSE) | ✅ | OpenAI-compatible SSE chunks on supported streaming routes. |
| Function / tool calling | Model-dependent | Use the authenticated model catalog's capability metadata; availability varies by route. |
| System messages | ✅ | Passed through to the underlying provider. |
| Token usage reporting | ✅ | `usage` in the response. |
| Vision / image inputs | Model-dependent | Per model: `capabilities.vision` is `true` in `GET /v1/models` and the catalog shows an "Image input" badge. Supported by Claude, GPT, Gemini, grok-4.6, Kimi, MiniMax and most Local Qwen/GLM models; send `image_url` data URLs. |
| Audio (TTS / STT) | — | Audio endpoints are not exposed. |
| Embeddings (`/v1/embeddings`) | ✅ | `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`; batch input, `dimensions` and base64 encoding supported. See [Models and pricing](https://docs.scalemax.pro/docs/models#embeddings). |
| Assistants / Threads | — | Not exposed. Out of scope. |
| Fine-tuning | — | Not exposed. Use the upstream provider directly. |

## Differences from OpenAI

- **Provider selection** is implicit in the `model` string. We don't expose a `provider` parameter.
- **Authentication** uses ScaleMax keys, not OpenAI keys. They live in the same `Authorization: Bearer` header though.
- **Rate limits** are per ScaleMax key, not per OpenAI organization.
- **Error envelope** matches OpenAI's shape:

error:

```json
{
  "error": {
    "message": "Invalid API key",
    "type": "authentication_error",
    "code": "invalid_credentials"
  }
}
```

## SDK compatibility

| SDK | Status |
| --- | --- |
| `openai` (Python) | ✅ works |
| `openai` (JavaScript / Node) | ✅ works |
| `openai-go` | ✅ works |
| `openai-compatible tools` | ⚠️ partial |
| `langchain` (via OpenAI adapter) | ✅ works |
| Cursor / OpenAI-compatible tools | ✅ works (point at ScaleMax base URL) |

For SDK-specific examples see the [OpenAI SDK](https://docs.scalemax.pro/docs/examples/openai-sdk) example.
