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

# OpenAI SDK

> Use official OpenAI SDKs with Phaseo.

Use this guide when your app already calls OpenAI from TypeScript, JavaScript, or Python. Change only the API key, base URL, and model id.

## TypeScript

```bash theme={null}
npm install openai
```

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

const client = new OpenAI({
	apiKey: process.env.PHASEO_API_KEY,
	baseURL: "https://api.phaseo.ai/v1",
});

const response = await client.responses.create({
	model: "openai/gpt-5-nano",
	input: "Write one sentence about reliable model routing.",
});

console.log(response.output_text);
```

## Python

```bash theme={null}
pip install openai
```

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

client = OpenAI(
    api_key=os.environ["PHASEO_API_KEY"],
    base_url="https://api.phaseo.ai/v1",
)

response = client.responses.create(
    model="openai/gpt-5-nano",
    input="Write one sentence about reliable model routing.",
)

print(response.output_text)
```

## Chat Completions

Older libraries may still call Chat Completions:

```ts theme={null}
const completion = await client.chat.completions.create({
	model: "openai/gpt-5-nano",
	messages: [{ role: "user", content: "Reply with only: ok" }],
});
```

## Notes

* Use Phaseo model ids, including provider prefixes such as `openai/`, `anthropic/`, or `google/`.
* Server tools use Phaseo tool names such as `phaseo:web_search`.
* For Anthropic-native clients, use the [Anthropic SDK](./anthropic-sdk.mdx) guide instead.

## Related

* [Responses API](../../api-reference/endpoint/responses.mdx)
* [Chat Completions](../../api-reference/endpoint/chat-completions.mdx)
* [Server Tools](../server-tools/index.mdx)
