> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Model state and lookup SDK Reference

> SDK reference for Model state and lookup in the Models API, available in Node.js and Python.

## Models

### Validate a Model

Validates a provider endpoint by performing a minimal live probe. Currently supports Azure OpenAI. Response includes the resolved region, whether the model is known to Orq, and either the full model document or a synthesized default.

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY"),
) as orq:

    orq.models.validate(api_key="<value>", provider="<value>")

```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { Orq } from "@orq-ai/node";

const orq = new Orq({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  await orq.models.validate({
    apiKey: "<value>",
    provider: "<value>",
  });

}

run();
```

**Parameters**

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
    "api_key": str,  # required
    "provider": str,  # required
    "api_version": Optional[str],
    "base_url": Optional[str],
    "deployment_name": Optional[str],
    "endpoint": Optional[str],
    "subtype": Optional[str],
}
```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  apiKey: string;  // required
  apiVersion?: string;
  baseUrl?: string;
  deploymentName?: string;
  endpoint?: string;
  provider: string;  // required
  subtype?: string;
}
```

### Delete a Model

Deletes a custom model from the workspace. System models cannot be deleted. Returns 200 with an explanatory message if the model is a system model or is still referenced by experiments.

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY"),
) as orq:

    orq.models.delete(id="<id>")

```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { Orq } from "@orq-ai/node";

const orq = new Orq({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  await orq.models.delete({
    id: "<id>",
  });

}

run();
```

**Parameters**

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
    "id": str,  # required
}
```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  id: string;  // required
}
```

### Enable a Model

Adds the model to the workspace's enabled set. Idempotent: re-enabling an already-enabled model returns 204 with no state change.

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY"),
) as orq:

    orq.models.enable(model_id="<id>")

```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { Orq } from "@orq-ai/node";

const orq = new Orq({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  await orq.models.enable({
    modelId: "<id>",
  });

}

run();
```

**Parameters**

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
    "model_id": str,  # required
}
```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  modelId: string;  // required
}
```

### Disable a Model

Removes the model from the workspace's enabled set. Idempotent: disabling an already-disabled model returns 204.

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY"),
) as orq:

    orq.models.disable(model_id="<id>")

```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { Orq } from "@orq-ai/node";

const orq = new Orq({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  await orq.models.disable({
    modelId: "<id>",
  });

}

run();
```

**Parameters**

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
    "model_id": str,  # required
}
```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  modelId: string;  // required
}
```

### List Models

Lists all models available through the AI Router. Returns each model in OpenAI-compatible shape with its provider, ID, and creation timestamp.

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY"),
) as orq:

    res = orq.models.list()

    # Handle response
    print(res)

```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { Orq } from "@orq-ai/node";

const orq = new Orq({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  const result = await orq.models.list();

  console.log(result);
}

run();
```

**Response**

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
    "data": [{
        "created": int,
        "id": str,
        "object": Literal["model"],
        "owned_by": str,
    }],
    "object": Literal["list"],
}
```

```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  data: {
    created: number;
    id: string;
    object: "model";
    ownedBy: string;
  }[];
  object: "list";
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.