All Topics
All Topics
Technology
Technology
AI
AI
Business
Business
Entertainment
Entertainment
News
News
Programming
Programming
Security
Security
Science
Science
Design
Design
Environment
Environment
Finance
Finance
Crypto
Crypto
Politics
Politics
Sports
Sports
Education
Education
Gaming
Gaming
Art
Art
Music
Music
Health
Health
Books
Books
Food
Food
Travel
Travel
Personal
Personal
Bluesky
Twitter

AI Gateway - AI Gateway adds OpenAI compatible endpoint

1y ago

Source

CloudflareAI Gateway - AI Gateway adds OpenAI compatible endpointcloudflare.com
Snippet from the RSS feed
Users can now use an OpenAI Compatible endpoint in AI Gateway to easily switch between providers, while keeping the exact same request and response formats. We're launching now with the chat completions endpoint, with the embeddings endpoint coming up next. To get started, use the OpenAI compatible chat completions endpoint URL with your own account id and gateway id and switch between providers by changing the model and apiKey parameters. import OpenAI from "openai" ; const client = new OpenAI ( { apiKey : "YOUR_PROVIDER_API_KEY" , // Provider API key baseURL : " , } ) ; const response = await client . chat . completions . create ( { model : "google-ai-studio/gemini-2.0-flash" , messages : [ { role : "user" , content : "What is Cloudflare?" } ] , } ) ; console . log ( response . choices [ 0 ] . message . content ) ; Additionally, the OpenAI Compatible endpoint can be combined with our Universal Endpoint to add fallbacks across multiple providers. That means AI Gateway will return every response in the same standardized format, no extra parsing logic required! Learn more in the OpenAI Compatibility documentation.

You might also wanna read

Comments

Sign in to join the conversation.

No comments yet. Be the first.