Hey HN,<p>We’ve just rolled out an OpenAI-Compatible Endpoint at CustomGPT.ai that should make it super easy to try Retrieval-Augmented Generation (RAG) in your existing OpenAI-based code.<p>Now, hundreds of tools in the OpenAI ecosystem can add RAG capabilities with minimal changes.<p>Docs here - <a href="https://docs.customgpt.ai/reference/customgptai-openai-sdk-compatibility" rel="nofollow">https://docs.customgpt.ai/reference/customgptai-openai-sdk-c...</a><p>All you do is: 1. Swap your api_key to the CustomGPT one, 2. Change the base_url to our endpoint. And thats it.<p>You can keep using your OpenAI Python SDK code. Under the hood, we handle context retrieval from your project knowledge sources before generating a final answer.<p>We support the chat.completions endpoint with the same request/response structure. If you call an unsupported endpoint, we return a 404 or 501.<p>This opens up the entire ecosystem of OpenAI-compatible tools, frameworks, and services for your RAG workflows.
Everything else—conversation format, message handling, etc.—remains the same.<p>Check out a quick Python snippet:<p>from openai import OpenAI
client = OpenAI(
api_key="CUSTOMGPT_API_KEY",
base_url="<a href="https://app.customgpt.ai/api/v1/projects/{project_id}/" rel="nofollow">https://app.customgpt.ai/api/v1/projects/{project_id}/</a>"
)
response = client.chat.completions.create(
model="gpt-4", # We'll ignore the model param and use your project's default
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who are you?"}
],
)
print(response.choices[0].message.content)<p>We’re ignoring certain OpenAI parameters like model and temperature. If you try to call an endpoint we don’t support, you’ll get a 404 or 501. Otherwise, your code runs pretty much the same.<p>We built this because we kept hearing people say, “I’d like to try CustomGPT.ai for better context retrieval, but I already have so much code in the OpenAI ecosystem.” Hopefully this bridges the gap. Feedback and PR requests are welcome. Let us know how it goes!<p>Hope this helps folks who’ve been on the fence about trying RAG but don’t want to break everything they already have running!<p>If you have any question regrading the implementation, please ask below