> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.singularityapi.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.singularityapi.dev/_mcp/server.

# Contracts

## What a contract is

A contract is a permanent model name you own — for example `contract/support-agent` — that points at a catalog model you choose. You promote or roll back revisions from the dashboard's **Stable endpoints** page; your code keeps calling the same contract name. No silent model swaps: what serves the request only changes when you change it.

## Calling a contract

Send the same request you'd send to any model, with `model` set to `contract/{slug}`.

**`cURL`**

```bash title="cURL"
curl https://api.singularityapi.dev/v1/chat/completions \
  -H "Authorization: Bearer $SINGULARITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "contract/support-agent",
    "messages": [{"role": "user", "content": "Say hello."}]
  }'
```

**`Python`**

```python title="Python"
from openai import OpenAI

client = OpenAI(
    base_url="https://api.singularityapi.dev/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="contract/support-agent",
    messages=[{"role": "user", "content": "Say hello."}],
)
print(response.model)  # the served model, e.g. "deepseek-v4-flash"
```

**`JavaScript`**

```javascript title="JavaScript"
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.singularityapi.dev/v1",
  apiKey: "YOUR_API_KEY",
});

const response = await client.chat.completions.create({
  model: "contract/support-agent",
  messages: [{ role: "user", content: "Say hello." }],
});
console.log(response.model);
```

## Reading the response

* `model` in the response body is the served target — the catalog model that actually ran the request, e.g. `deepseek-v4-flash`.
* The `x-singularity-contract-revision` response header records the exact revision that served the request, e.g. `support-agent@3`.
* The [receipt](/platform/receipts-billing) for the request carries a `contract` block: `{"slug": "support-agent", "revision": 3}`.

## Rules

* A contract slug is 2–63 lowercase alphanumeric characters and hyphens, and may not start with `contract`.
* Requests cannot pin a revision — the active revision is resolved server-side, per request.
* Promotions and rollbacks take effect on the next request. No deploy required.
* An unknown or malformed contract name returns 404 `model_not_found`. See [Errors & Rate Limits](/api/errors-rate-limits).
* Contracts require API-key auth, same as any inference call.

> **Note**
>
> Creating and promoting contracts is dashboard-only, on the **Stable endpoints** page at `https://app.singularityapi.dev`. There is no public API for contract management.