# Set OpenRouter preferences

Source: https://immiscible.fly.dev/docs/api/put-api-w-wid-openrouter

`PUT /api/w/:wid/openrouter`

Owners and admins. Sent on every OpenRouter request as its `provider` object, replacing any the client sent. Recorded on the ledger.

| Field | Description |
|---|---|
| `allowFallbacks` | `true` or `false`: may OpenRouter try another host for the same model |
| `dataCollection` | `"allow"` or `"deny"`: only hosts that do not keep prompts when `"deny"` |
| `zdr` | `true` to use zero data retention endpoints only |
| `order`, `only`, `ignore` | lists of up to 20 OpenRouter provider slugs, such as `anthropic` or `amazon-bedrock` |
| `title` | the `X-Title` OpenRouter shows for your traffic, up to 80 characters |

## Authentication

Session cookie. A signed-in person: the console's session cookie. Every state-changing request also carries the header `x-immiscible-csrf: 1`, and the member's role decides what it may do. Bearer tokens are ignored on these routes, so no machine credential can reach them.

## Path parameters

- `wid` (string, required): Workspace id

## Request

curl:

```bash
curl -X PUT "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/openrouter" \
  -H "cookie: __Host-sid=$IMMISCIBLE_SESSION" \
  -H "x-immiscible-csrf: 1" \
  -H "content-type: application/json" \
  -d '{
    "dataCollection": "deny",
    "allowFallbacks": false,
    "title": "Acme agents"
  }'
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/openrouter', {
  method: 'PUT',
  headers: {
    cookie: `__Host-sid=${process.env.IMMISCIBLE_SESSION}`,
    'x-immiscible-csrf': '1',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    dataCollection: 'deny',
    allowFallbacks: false,
    title: 'Acme agents',
  }),
});
const data = await res.json();
console.log(res.status, data);
```

Python:

```python
import os
import requests

res = requests.put(
    "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/openrouter",
    headers={
        "cookie": f"__Host-sid={os.environ['IMMISCIBLE_SESSION']}",
        "x-immiscible-csrf": "1",
        "content-type": "application/json",
    },
    json={
        "dataCollection": "deny",
        "allowFallbacks": False,
        "title": "Acme agents",
    },
)
print(res.status_code, res.json())
```
