Replacing OpenAI with ZC Technologies can save you up to 70% on your LLM costs without changing your application's codebase. By updating a single URL endpoint and switching to ZC Inference Exchange, you can maintain the same application behavior while significantly reducing your expenses. This guide will show you how to make the switch with a before and after code comparison, ensuring your application continues to function as expected while benefiting from lower pricing.
Here is an example of how you might be currently calling the OpenAI API in your application:
import requests
headers = {
'Authorization': 'Bearer YOUR-OPENAI-API-KEY',
'Content-Type': 'application/json'
}
payload = {
'model': 'gpt-3.5-turbo',
'messages': [{'role': 'user', 'content': 'What is the capital of France?'}]
}
response = requests.post('https://api.openai.com/v1/chat/completions', headers=headers, json=payload)
print(response.json())
To switch to ZC Technologies, you only need to change the endpoint URL and your API key. Here is how your code would look after the transition:
import requests
headers = {
'Authorization': 'Bearer YOUR-ZC-TECHNOLOGIES-API-KEY',
'Content-Type': 'application/json'
}
payload = {
'model': 'qwen2.5:32b',
'messages': [{'role': 'user', 'content': 'What is the capital of France?'}]
}
response = requests.post('https://zcx.zctechnologies.org/v1/chat/completions', headers=headers, json=payload)
print(response.json())
The cost savings are substantial. For example, the OpenAI pricing for 1 million tokens is around $200, whereas ZC Technologies offers the same volume at $33 per 1 million tokens under the Business plan. This translates to a 70% cost reduction.
Switching from OpenAI to ZC Technologies is a straightforward process that can significantly reduce your LLM costs. By simply changing the API endpoint and your API key, you can maintain the same application behavior while saving up to 70% on your token usage. To learn more about our pricing plans and to sign up for a prepaid LLM credit line, visit our website at https://zcx.zctechnologies.org#plans.