Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,10 @@ Ensure your gateway has [authentication](/ai-gateway/configuration/authenticatio
- Click **Save** to save the state. You can always roll back to earlier versions from **Versions**.
- Deploy the version to make it live.
5. Call the route from your code.
- Use the [OpenAI compatible](/ai-gateway/usage/chat-completion/) endpoint, and use the route name in place of the model, for example, `dynamic/support`.
- Use the [OpenAI compatible](/ai-gateway/usage/chat-completion/) endpoint (`/compat/chat/completions`), and use the route name in place of the model, for example, `dynamic/support`. See [Using a dynamic route](/ai-gateway/features/dynamic-routing/usage/) for examples.

:::note

The OpenAI-compatible endpoint is marked **Deprecated** for standard single-model chat completions, but it remains the required way to call dynamic routes. Dynamic routing is not currently available on the [REST API](/ai-gateway/usage/rest-api/).

:::
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
pcx_content_type: how-to
title: Using a dynamic route
description: Send requests through an AI Gateway dynamic route using the OpenAI SDK or REST API.
description: Send requests through an AI Gateway dynamic route using the OpenAI SDK, a direct HTTP request, or the Workers AI binding.
sidebar:
order: 2
products:
Expand Down
8 changes: 6 additions & 2 deletions src/content/docs/ai-gateway/usage/chat-completion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ import {
} from "~/components";
import CodeSnippets from "~/components/ai-gateway/code-examples.astro";

:::caution[Deprecated]
This endpoint is deprecated. Use the [REST API](/ai-gateway/usage/rest-api/) instead, which provides OpenAI-compatible endpoints at `api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1/chat/completions`. The `/compat/chat/completions` endpoint will continue to work for existing integrations.
:::caution[Deprecated for single-model calls]
For standard single-model chat completions, this endpoint is deprecated. Use the [REST API](/ai-gateway/usage/rest-api/) instead, which provides OpenAI-compatible endpoints at `api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1/chat/completions`. The `/compat/chat/completions` endpoint will continue to work for existing integrations.
:::

:::note[Required for dynamic routing]
[Dynamic routes](/ai-gateway/features/dynamic-routing/) (`dynamic/{route}`) are invoked through this `/compat/chat/completions` endpoint. The REST API does not currently cover dynamic routing, so continue to use this endpoint when calling a dynamic route. See [Using a dynamic route](/ai-gateway/features/dynamic-routing/usage/) for examples.
:::

Cloudflare's AI Gateway offers an OpenAI-compatible `/chat/completions` endpoint, enabling integration with multiple AI providers using a single URL. This feature simplifies the integration process, allowing for seamless switching between different models without significant code modifications.
Expand Down
Loading