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

# Use Compose from AI SDK

> Configure AI SDK with Compose's OpenAI-compatible external API.

Use the AI SDK OpenAI-compatible provider when you want AI SDK calls to run through Compose billing and catalog routing.

## Install

```bash theme={null}
npm install ai @ai-sdk/openai-compatible
```

## Configure the provider

```ts theme={null}
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";

export const compose = createOpenAICompatible({
  name: "compose-market",
  baseURL: "https://api.compose.market/external/v1",
  apiKey: process.env.COMPOSE_MARKET_API_KEY,
  includeUsage: true,
});
```

## Generate text

```ts theme={null}
import { generateText } from "ai";
import { compose } from "./compose";

const result = await generateText({
  model: compose("gpt-5.5"),
  messages: [
    { role: "user", content: "Write a short release note." },
  ],
});

console.log(result.text);
```

## Use provider aliases

Use public catalog IDs exactly as Compose exposes them:

```ts theme={null}
const azure = compose("gpt-5.5");
const openai = compose("openai/gpt-5.5");
```

`gpt-5.5` and `openai/gpt-5.5` are different public IDs. They resolve to different provider rows.

## Keep receipts out of AI SDK streams

Use `/external/v1` with AI SDK. External routes keep response bodies OpenAI-shaped and do not inject Compose receipt events into the stream.

If your backend needs receipts, call native `/v1/*` directly and read `X-Receipt`.

## Related

* [External clients](/inference/external-use/overview)
* [OpenCode config](/inference/external-use/configs/well-known-opencode)
* [Tools](/inference/tools)
