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

> ## Agent Instructions
> To act on Atlan objects, use the Atlan MCP server at https://api.atlan.com/mcp or the SDK. To install or publish skills from a terminal, use the `aireg` CLI; `aireg --map json` prints its command map. The `atlanai` CLI is deprecated. Run a read-only identity check before any write.
> The docs MCP server at /mcp searches these docs only. It cannot read or change Atlan objects.
> SDK packages: Python `atlanai` (PyPI) and TypeScript `@atlanai/sdk` (npm). Show Python first, then TypeScript.
> These docs cover Atlan AI Registry, Atlan's hosted product. The AI registry specification and aireg CLI are maintained separately. /open-source lists publicly reachable signed installers and explains that the source repository and hosted CLI reference currently require GitHub access. Do not claim the repository or its reference docs are publicly accessible. Use these docs for Atlan-specific setup such as the adapter, sign-in and workspaces.

# Migrate existing model calls

> Move code that calls OpenAI or Anthropic directly onto Model Gateway by changing the base URL, the API key, and the model name.

Move an application that calls OpenAI or Anthropic directly onto Model Gateway. You change three things: the base URL, the API key, and the model name. Your messages, tools, and streaming code stay as they are.

| Change | From | To |
| - | - | - |
| Base URL, OpenAI SDKs | The SDK default | `https://api.atlan.com/openai/v1` |
| Base URL, Anthropic SDK | The SDK default | `https://api.atlan.com/anthropic` (the SDK adds `/v1/messages`) |
| API key | Your provider key | Your Atlan agent key, `ATLAN_API_KEY` |
| Model name | The vendor's model id | `<provider>/<model>`, copied from `GET /openai/v1/models` |

Either dialect reaches every chat model your organization connects, so you don't have to match the SDK to the provider.

## Before you begin

* You have an Atlan agent key in `ATLAN_API_KEY`. See [Connect client to Model Gateway](/gateway/model/how-tos/connect-a-client) to create one.
* You have the `id` of each model you'll call, from `GET /openai/v1/models`.
* Every operation your code calls is served. Files, batches, assistants, vector stores, fine-tuning, and Anthropic token counting aren't; see [Model API compatibility](/gateway/model/references/compatibility).

<Steps>
  <Step title="Change the client configuration">
    Pick your library and change the client setup.

    <Tabs>
      <Tab title="OpenAI (Python)">
        ```python Before theme={null}
        import os

        from openai import OpenAI

        client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
        reply = client.chat.completions.create(model="<model>", messages=messages)
        ```

        ```python After theme={null}
        import os

        from openai import OpenAI

        client = OpenAI(
            base_url="https://api.atlan.com/openai/v1",
            api_key=os.environ["ATLAN_API_KEY"],
        )
        reply = client.chat.completions.create(model="<provider>/<model>", messages=messages)
        ```
      </Tab>

      <Tab title="OpenAI (TypeScript)">
        ```typescript Before theme={null}
        import OpenAI from "openai";

        const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
        const reply = await client.chat.completions.create({ model: "<model>", messages });
        ```

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

        const client = new OpenAI({
          baseURL: "https://api.atlan.com/openai/v1",
          apiKey: process.env.ATLAN_API_KEY,
        });
        const reply = await client.chat.completions.create({ model: "<provider>/<model>", messages });
        ```
      </Tab>

      <Tab title="Anthropic (Python)">
        The Anthropic SDK sends its `api_key` in the `x-api-key` header, which the gateway accepts on the Anthropic dialect.

        ```python Before theme={null}
        import os

        from anthropic import Anthropic

        client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
        reply = client.messages.create(model="<model>", max_tokens=1024, messages=messages)
        ```

        ```python After theme={null}
        import os

        from anthropic import Anthropic

        client = Anthropic(
            base_url="https://api.atlan.com/anthropic",
            api_key=os.environ["ATLAN_API_KEY"],
        )
        reply = client.messages.create(model="<provider>/<model>", max_tokens=1024, messages=messages)
        ```
      </Tab>

      <Tab title="LangChain">
        `ChatOpenAI` speaks the OpenAI dialect, so it reaches any chat model through the gateway.

        ```python Before theme={null}
        import os

        from langchain_openai import ChatOpenAI

        llm = ChatOpenAI(model="<model>", api_key=os.environ["OPENAI_API_KEY"])
        ```

        ```python After theme={null}
        import os

        from langchain_openai import ChatOpenAI

        llm = ChatOpenAI(
            model="<provider>/<model>",
            base_url="https://api.atlan.com/openai/v1",
            api_key=os.environ["ATLAN_API_KEY"],
        )
        ```
      </Tab>

      <Tab title="Vercel AI SDK">
        Create an OpenAI provider pointed at the gateway, and call the chat completions API with `.chat()`.

        ```typescript Before theme={null}
        import { openai } from "@ai-sdk/openai";
        import { generateText } from "ai";

        const { text } = await generateText({ model: openai("<model>"), prompt });
        ```

        ```typescript After theme={null}
        import { createOpenAI } from "@ai-sdk/openai";
        import { generateText } from "ai";

        const atlan = createOpenAI({
          baseURL: "https://api.atlan.com/openai/v1",
          apiKey: process.env.ATLAN_API_KEY,
        });
        const { text } = await generateText({ model: atlan.chat("<provider>/<model>"), prompt });
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Replace each model name">
    Swap every model id for the gateway's qualified name. A bare vendor id, without the provider part, returns `404` with `model not found`.
  </Step>

  <Step title="Check the fields you send">
    Fields that only tune or annotate a request, such as `metadata` or `seed`, are dropped when the serving provider has no place for them, and named in the `x-gateway-model-dropped` response header. Fields that change the reply, such as `logprobs`, are refused with `400` when the provider can't honor them. If you use the Responses API, send the whole conversation each time: `previous_response_id` and stored conversations are refused.
  </Step>
</Steps>

## Verify

1. Run your application. It answers as before.
2. Inspect one response's headers: `x-gateway-model-wire` names the provider API that served it.
3. In Model Gateway studio, an organization admin finds the agent's calls on **Agents** and in **Usage**. See [Review model usage](/gateway/model/how-tos/review-usage).

If a call fails, look up its status in [Model Gateway errors](/gateway/model/troubleshooting).

## Related

* [Connect client to Model Gateway](/gateway/model/how-tos/connect-a-client): create an agent key and set up coding clients such as Claude Code and Codex.
* [How Model Gateway works](/gateway/model/concepts/how-it-works): what the gateway does with each request.
* [Model API compatibility](/gateway/model/references/compatibility): served endpoints and field handling.


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