# ai& SDK

Source: https://staging-docs.aiand.com/sdks/aiand/

The official ai& SDKs are generated from the public OpenAPI spec and ship full type definitions. They cover the same OpenAI-compatible surface as the rest of the platform.

<Aside type="tip">
  Already using the `openai` SDK? It works against ai& too — see [OpenAI SDK](/sdks/openai/). The first-party SDKs below are typed end-to-end and track the spec exactly.
</Aside>

## Setup

<Tabs>
<TabItem label="Python">

```bash
pip install aiand
```

```python
import aiand

configuration = aiand.Configuration(access_token="sk-your-aiand-api-key")
client = aiand.OpenaiApi(aiand.ApiClient(configuration))

models = client.list_models()
print(models.data[0].id)
```

</TabItem>
<TabItem label="TypeScript">

```bash
npm install @aiand/sdk
```

```ts

const client = new OpenaiApi(
  new Configuration({ accessToken: "sk-your-aiand-api-key" }),
);

const models = await client.listModels();
console.log(models.data[0].id);
```

</TabItem>
</Tabs>

## Chat completion

<Tabs>
<TabItem label="Python">

```python
response = client.create_chat_completion(
    aiand.CreateChatCompletionRequest.from_dict({
        "model": "deepseek-ai/deepseek-v4-flash",
        "messages": [{"role": "user", "content": "Hello"}],
    })
)
print(response.choices[0].message.content)
```

</TabItem>
<TabItem label="TypeScript">

```ts
const response = await client.createChatCompletion({
  createChatCompletionRequest: {
    model: "deepseek-ai/deepseek-v4-flash",
    messages: [{ role: "user", content: "Hello" }],
  },
});
console.log(response.choices[0].message.content);
```

</TabItem>
</Tabs>

## Responses

<Tabs>
<TabItem label="Python">

```python
response = client.create_response(
    aiand.CreateResponseRequest(
        model="deepseek-ai/deepseek-v4-flash",
        input=aiand.ResponseInput("Hello"),
    )
)
print(response.output[0].content[0].text)
```

</TabItem>
<TabItem label="TypeScript">

```ts
const response = await client.createResponse({
  createResponseRequest: {
    model: "deepseek-ai/deepseek-v4-flash",
    input: "Hello",
  },
});
console.log(response.output);
```

</TabItem>
</Tabs>

## Other surfaces

- `list_models()` / `listModels()` — [Models](/api/models/)
- Files, uploads, and more follow the same client — see [Files](/api/files/)

<Aside type="note">
  Both SDKs are versioned independently: [`aiand` on PyPI](https://pypi.org/project/aiand/) and [`@aiand/sdk` on npm](https://www.npmjs.com/package/@aiand/sdk). They require Python ≥3.10 and Node ≥18 respectively.
</Aside>
