← Back
Cloudflare AI Search launches OpenAI-compatible REST API for search and chat completions
Cloudflare · apifeatureplatform · developers.cloudflare.com ↗

OpenAI-Compatible REST API

Cloudflare AI Search has introduced new REST API endpoints that conform to OpenAI's standard format, enabling seamless integration with existing OpenAI SDKs and tooling. This standardization reduces friction for developers familiar with OpenAI's API design.

New Endpoints

Two key endpoints are now available:

  • Chat Completions: POST /accounts/{account_id}/ai-search/instances/{name}/chat/completions
  • Search: POST /accounts/{account_id}/ai-search/instances/{name}/search

Both endpoints accept the familiar messages array structure, allowing developers to pass system prompts and user messages in a standardized format.

Multi-Turn Conversation Support

The new API supports conversation context through message history. Developers can pass previous messages within a session, enabling the model to maintain context across multiple turns without manually managing state externally.

Migration Path

Existing users of the AutoRAG API endpoints (/autorag/rags/) can continue using those endpoints, but Cloudflare recommends migrating to the new endpoints since all future features will be added exclusively to the new API. The company guarantees at least 90 days notice before deprecating the previous endpoints, providing a clear migration window.