Replacing your OpenAI integration with ZC Inference Exchange can reduce your costs by up to 70% without changing your application code. This guide demonstrates how to switch to ZC Inference Exchange by updating a single URL, maintaining the same behavior while significantly lowering your bill. ZC Inference Exchange offers an OpenAI-compatible API, making the transition seamless for engineers who have built applications using the /v1/chat/completions endpoint.
To illustrate the transition, let's start with a typical OpenAI integration. Your application might use the following code snippet to interact with OpenAI's API:
import requests
openai_url = 'https://api.openai.com/v1/chat/completions'
headers = {
'Authorization': 'Bearer YOUR_OPENAI_API_KEY',
'Content-Type': 'application/json'
}
data = {
'model': 'gpt-3.5-turbo',
'messages': [{'role': 'user', 'content': 'Hello, how are you?'}]
}
response = requests.post(openai_url, headers=headers, json=data)
print(response.json())
To switch to ZC Inference Exchange, you only need to change the URL and API key. The rest of your code remains the same. Here is the updated code:
import requests
zcx_url = 'https://zcx.zctechnologies.org/v1/chat/completions'
headers = {
'Authorization': 'Bearer YOUR_ZCX_API_KEY',
'Content-Type': 'application/json'
}
data = {
'model': 'qwen2.5:32b',
'messages': [{'role': 'user', 'content': 'Hello, how are you?'}]
}
response = requests.post(zcx_url, headers=headers, json=data)
print(response.json())
The cost savings are significant. For instance, the Starter plan at ZC Inference Exchange offers 1.5M tokens for $99 per month, which is $66 per 1M tokens. In contrast, OpenAI's pricing for similar usage is approximately $200 per 1M tokens, representing a 67% cost reduction. Our Pro and Business plans offer even better rates, making ZC Inference Exchange the most cost-effective solution for large-scale applications.
Switching to ZC Inference Exchange is straightforward and can lead to substantial cost savings. By simply changing the API URL and key, you can maintain the same application behavior while enjoying a significant reduction in your monthly bill. To start saving today, sign up for a prepaid LLM credit line at https://zcx.zctechnologies.org#plans.