# ai& API Documentation

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

## Overview

ai& serves open-weight LLMs from our own infrastructure through OpenAI- and Anthropic-compatible APIs. Point your existing SDK at our base URL — your code runs unchanged against the open-source models we host, with per-token credit billing.

## Base URL

```
https://api.aiand.com
```

All API endpoints are served from this base URL. Authentication is required for all requests.

## Your first call

<Tabs syncKey="lang">
<TabItem label="curl">

```bash
curl https://api.aiand.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-oss-120b",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

</TabItem>
<TabItem label="Python">

```python
from openai import OpenAI

client = OpenAI(base_url="https://api.aiand.com/v1", api_key="sk-...")

response = client.chat.completions.create(
    model="openai/gpt-oss-120b",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```

</TabItem>
<TabItem label="Node.js">

```ts

const client = new OpenAI({
  baseURL: "https://api.aiand.com/v1",
  apiKey: "sk-...",
});

const response = await client.chat.completions.create({
  model: "openai/gpt-oss-120b",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
```

</TabItem>
</Tabs>

## What you get

<CardGrid>
  <Card title="OpenAI Compatible" icon="rocket">
    Drop-in replacement for `/v1/chat/completions`.
    Works with the OpenAI SDK, LangChain, LlamaIndex, and anything that speaks the OpenAI format.
  </Card>
  <Card title="Open Source Models" icon="random">
    Access open source models through a single API key.
    Same OpenAI-compatible request format across all models.
  </Card>
  <Card title="Multimodal Inputs" icon="puzzle">
    Upload images and video once via the [Files API](/api/files/), then reference by `file_id` in chat completions.
    OpenAI-canonical wire shape — vanilla SDK works.
  </Card>
  <Card title="Credit Billing" icon="approve-check-circle">
    Pay-per-token with automatic credit deduction.
    Per-model pricing — you only pay for what you use. Failed requests are not billed.
  </Card>
</CardGrid>

## Next steps

<CardGrid>
  <LinkCard title="Quick Start" href="/getting-started/" description="From zero to your first call in five minutes." />
  <LinkCard title="Model Catalog" href="/models/catalog/" description="Open-weight models with prices, capabilities, and context windows." />
  <LinkCard title="Chat Completions" href="/api/chat-completions/" description="Endpoint reference — request and response shapes." />
  <LinkCard title="Migrating from OpenAI" href="/migrating-openai/" description="Two lines of config to point your existing OpenAI code at ai&." />
</CardGrid>
