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

# OpenAI

> Integrate OpenAI models through the Adaline Proxy for automatic telemetry and observability.

# OpenAI

Integrate OpenAI models through the Adaline Proxy to automatically capture telemetry — requests, responses, token usage, latency, and costs — with minimal code changes.

## Supported Models

**Chat Models**

| Model | Description |
| - | - |
| `gpt-5.3-codex` | Latest Codex model |
| `gpt-5.2-pro` | Latest flagship model |
| `gpt-5.2` | High capability next-gen model |
| `gpt-5.2-codex` | GPT-5.2 Codex |
| `chatgpt-5.2` | ChatGPT 5.2 |
| `gpt-5.2-chat-latest` | GPT-5.2 chat latest snapshot |
| `gpt-5.1` | Next-gen model |
| `gpt-5` | GPT-5 series base |
| `gpt-5-mini` | Compact GPT-5 |
| `gpt-5-nano` | Ultra-compact GPT-5 |
| `gpt-5-chat-latest` | GPT-5 chat latest snapshot |
| `gpt-4.1` | Improved GPT-4 with enhanced reasoning |
| `gpt-4.1-mini` | Compact GPT-4.1 |
| `gpt-4.1-nano` | Ultra-compact GPT-4.1 |
| `gpt-4o` | Multimodal with vision support |
| `gpt-4o-2024-08-06` | GPT-4o August 2024 snapshot |
| `gpt-4o-2024-05-13` | GPT-4o May 2024 snapshot |
| `chatgpt-4o-latest` | ChatGPT-4o latest snapshot |
| `gpt-4o-mini` | Fast and cost-effective multimodal |
| `gpt-4o-mini-2024-07-18` | GPT-4o Mini July 2024 snapshot |
| `gpt-4-turbo` | High capability with 128k context |
| `gpt-4-turbo-2024-04-09` | GPT-4 Turbo April 2024 snapshot |
| `gpt-4-turbo-preview` | GPT-4 Turbo preview |
| `gpt-4` | Original GPT-4 model |
| `gpt-4-0613` | GPT-4 June 2023 snapshot |
| `gpt-4-0125-preview` | GPT-4 January 2024 preview |
| `gpt-4-1106-preview` | GPT-4 November 2023 preview |
| `gpt-3.5-turbo` | Fast and cost-effective |
| `gpt-3.5-turbo-0125` | GPT-3.5 Turbo January 2024 snapshot |
| `gpt-3.5-turbo-1106` | GPT-3.5 Turbo November 2023 snapshot |
| `o4-mini` | Latest compact reasoning model |
| `o4-mini-2025-04-16` | O4 Mini April 2025 snapshot |
| `o3` | Advanced reasoning model |
| `o3-2025-04-16` | O3 April 2025 snapshot |
| `o3-mini` | Compact reasoning model |
| `o3-mini-2025-01-31` | O3 Mini January 2025 snapshot |
| `o1` | Reasoning model for complex tasks |
| `o1-2024-12-17` | O1 December 2024 snapshot |

**Embedding Models**

| Model | Description |
| - | - |
| `text-embedding-3-large` | Highest quality embeddings |
| `text-embedding-3-small` | Balanced quality and cost |
| `text-embedding-ada-002` | Legacy embedding model |

## Proxy Base URL

```
https://gateway.adaline.ai/v1/openai/
```

## Prerequisites

1. An [OpenAI API key](https://platform.openai.com/api-keys)
2. An [Adaline API key](https://www.adaline.ai/docs/admin/create-api-keys.md), project ID, and prompt ID

## Chat Completions

### Complete Chat

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="your-openai-api-key",
    base_url="https://gateway.adaline.ai/v1/openai/"
)

headers = {
    "adaline-api-key": "your-adaline-api-key",
    "adaline-project-id": "your-project-id",
    "adaline-prompt-id": "your-prompt-id"
}

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is machine learning?"}
    ],
    extra_headers=headers
)

print(response.choices[0].message.content)
```

```typescript TypeScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "your-openai-api-key",
  baseURL: "https://gateway.adaline.ai/v1/openai/",
});

const response = await client.chat.completions.create(
  {
    model: "gpt-4o",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "What is machine learning?" },
    ],
  },
  {
    headers: {
      "adaline-api-key": "your-adaline-api-key",
      "adaline-project-id": "your-project-id",
      "adaline-prompt-id": "your-prompt-id",
    },
  }
);

console.log(response.choices[0].message.content);
```

### Stream Chat

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="your-openai-api-key",
    base_url="https://gateway.adaline.ai/v1/openai/"
)

headers = {
    "adaline-api-key": "your-adaline-api-key",
    "adaline-project-id": "your-project-id",
    "adaline-prompt-id": "your-prompt-id"
}

stream = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing in simple terms."}
    ],
    stream=True,
    stream_options={"include_usage": True},
    extra_headers=headers
)

for chunk in stream:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")
```

```typescript TypeScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "your-openai-api-key",
  baseURL: "https://gateway.adaline.ai/v1/openai/",
});

const stream = await client.chat.completions.create(
  {
    model: "gpt-4o",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "Explain quantum computing in simple terms." },
    ],
    stream: true,
    stream_options: { include_usage: true },
  },
  {
    headers: {
      "adaline-api-key": "your-adaline-api-key",
      "adaline-project-id": "your-project-id",
      "adaline-prompt-id": "your-prompt-id",
    },
  }
);

for await (const chunk of stream) {
  const content = chunk.choices[0]?.delta?.content;
  if (content) process.stdout.write(content);
}
```

## Embeddings

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="your-openai-api-key",
    base_url="https://gateway.adaline.ai/v1/openai/"
)

headers = {
    "adaline-api-key": "your-adaline-api-key",
    "adaline-project-id": "your-project-id",
    "adaline-prompt-id": "your-prompt-id"
}

response = client.embeddings.create(
    model="text-embedding-3-small",
    input="The quick brown fox jumps over the lazy dog",
    extra_headers=headers
)

embedding = response.data[0].embedding
print(f"Embedding dimension: {len(embedding)}")
```

```typescript TypeScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "your-openai-api-key",
  baseURL: "https://gateway.adaline.ai/v1/openai/",
});

const response = await client.embeddings.create(
  {
    model: "text-embedding-3-small",
    input: "The quick brown fox jumps over the lazy dog",
  },
  {
    headers: {
      "adaline-api-key": "your-adaline-api-key",
      "adaline-project-id": "your-project-id",
      "adaline-prompt-id": "your-prompt-id",
    },
  }
);

console.log(`Embedding dimension: ${response.data[0].embedding.length}`);
```

## Optional Headers

Customize tracing behavior with optional headers:

```python theme={null}
headers = {
    # Required
    "adaline-api-key": "your-adaline-api-key",
    "adaline-project-id": "your-project-id",
    "adaline-prompt-id": "your-prompt-id",
    # Optional
    "adaline-trace-name": "openai-chat-completion",
    "adaline-trace-session-id": "user-session-123",
    "adaline-span-name": "gpt-4o-call",
    "adaline-trace-tags": '["production", "chat"]',
    "adaline-trace-attributes": '{"create": {"userId": "user-123"}}',
}
```

See the full [Headers Reference](https://www.adaline.ai/docs/reference/proxy/headers.md) for all available options.

## Next Steps

* [Multi-Step Workflows](https://www.adaline.ai/docs/integrations/examples/multi-step-workflows.md) — RAG pipelines, multi-step generation, and conversational agents
* [Headers Reference](https://www.adaline.ai/docs/reference/proxy/headers.md) — Complete header documentation

***

> [card] [Back to Integrations](https://www.adaline.ai/docs/integrations/introduction.md)
>
> Browse all integrations


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