Replacing your OpenAI API calls with ZC Technologies' OpenAI-compatible API can save you up to 70% on your token costs. This guide will walk you through the process of switching to our API, demonstrating that you can achieve the same behavior with significantly lower costs. ZC Technologies offers competitive pricing, starting at $33 per million tokens for our Business plan, compared to OpenAI's rates. The switch involves changing a single URL in your application code and obtaining an authentication token from ZC Technologies.
To illustrate the transition, let's start with a typical OpenAI API call. Here is an example of how you might be calling the /v1/chat/completions endpoint:
import requests
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(url, headers=headers, json=data)
print(response.json())
To switch to ZC Technologies, you need to change the URL to our /v1/chat endpoint and use our Bearer token for authentication. The rest of the code remains the same. Here is the updated code:
import requests
url = 'https://api.zcx.zctechnologies.org/v1/chat'
headers = {
'Authorization': 'Bearer YOUR_ZC_TECHNOLOGIES_API_KEY',
'Content-Type': 'application/json'
}
data = {
'model': 'qwen2.5:32b',
'messages': [{'role': 'user', 'content': 'Hello, how are you?'},]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
For a more concrete example, let's compare the cost of 1 million tokens between OpenAI and ZC Technologies. OpenAI charges approximately $120 per million tokens for their models, while ZC Technologies offers a Business plan that costs $33 per million tokens. This represents a significant saving of over 70%.
Migrating to ZC Technologies for your LLM needs can significantly reduce your operational costs without compromising on performance. Our API is fully compatible with OpenAI's, making the transition straightforward. To get started, sign up for a prepaid LLM credit line at https://zcx.zctechnologies.org#plans.