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

# SDK Integration

> Connect your SDK to the ngrok AI Gateway.

<Note>
  **Prerequisite**: Complete the [Quickstart](/ai-gateway/quickstart) to create an access key on [app.ngrok.ai](https://app.ngrok.ai).
</Note>

The AI Gateway works with official and third-party SDKs. Point the base URL at `https://gateway.ngrok.ai` and use your [access key](/ai-gateway/concepts/access-keys).

## Supported SDKs

<CardGroup cols={2}>
  <Card title="OpenAI SDK" icon="circle-nodes" href="/ai-gateway/sdks/openai">
    Official SDKs for Python, TypeScript, Go, Java, and .NET
  </Card>

  <Card title="Anthropic SDK" icon="message-bot" href="/ai-gateway/sdks/anthropic">
    Official SDKs for Python, TypeScript, Java, Go, Ruby, C#, and PHP
  </Card>

  <Card title="Vercel AI SDK" icon="triangle" href="/ai-gateway/sdks/vercel-ai-sdk">
    Build AI apps with React, Next.js, and streaming
  </Card>

  <Card title="TanStack AI" icon="layer-group" href="/ai-gateway/sdks/tanstack-ai">
    Type-safe AI library for React and Solid
  </Card>

  <Card title="LangChain" icon="link" href="/ai-gateway/sdks/langchain">
    Framework for chains, agents, and RAG
  </Card>

  <Card title="Other SDKs" icon="code" href="/ai-gateway/sdks/other">
    cURL, HTTP clients
  </Card>
</CardGroup>

## Quick start

The pattern is the same for any SDK—set the gateway URL and your [access key](/ai-gateway/concepts/access-keys).

<CodeGroup>
  ```python Python (OpenAI) theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://gateway.ngrok.ai/v1",
      api_key="ng-xxxxx-g1-xxxxx"  # Your access key
  )
  ```

  ```python Python (Anthropic) theme={null}
  import anthropic

  client = anthropic.Anthropic(
      base_url="https://gateway.ngrok.ai",
      api_key="ng-xxxxx-g1-xxxxx"  # Your access key
  )
  ```

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

  const client = new OpenAI({
    baseURL: "https://gateway.ngrok.ai/v1",
    apiKey: "ng-xxxxx-g1-xxxxx",  // Your access key
  });
  ```

  ```typescript TypeScript (Anthropic) theme={null}
  import Anthropic from "@anthropic-ai/sdk";

  const client = new Anthropic({
    baseURL: "https://gateway.ngrok.ai",
    apiKey: "ng-xxxxx-g1-xxxxx",  // Your access key
  });
  ```
</CodeGroup>

## What works through the gateway

| Feature               | Supported          |
| --------------------- | ------------------ |
| Chat Completions API  | ✅                  |
| Messages API          | ✅ (Anthropic SDKs) |
| Responses API         | ✅                  |
| Streaming             | ✅                  |
| Function/tool calling | ✅                  |
| Async clients         | ✅                  |

## Gateway benefits

Routing your SDK through the gateway gives you:

* Automatic failover that retries with the next key or model on failure.
* Provider switching by changing the model, with no integration code changes.
* One access key for multiple upstream providers.

## Using different providers

Use model prefixes or catalog names:

```python theme={null}
client.chat.completions.create(model="gpt-4o", ...)  # OpenAI
client.chat.completions.create(model="claude-opus-4-6", ...)  # Anthropic
client.chat.completions.create(model="openai:gpt-4o", ...)  # Explicit provider
```

## Next steps

* [OpenAI SDK](/ai-gateway/sdks/openai)
* [Anthropic SDK](/ai-gateway/sdks/anthropic)
* [Vercel AI SDK](/ai-gateway/sdks/vercel-ai-sdk)
* [TanStack AI](/ai-gateway/sdks/tanstack-ai)
* [LangChain](/ai-gateway/sdks/langchain)
* [Other SDKs](/ai-gateway/sdks/other)
