ZC · INFERENCE

Transform your apps with ZCX\u2019s RAG solutions, offering 60-80% cheaper per 1M tokens than Anthropic and OpenAI. Submit 4 songs for $19 at soundpitch.zctechnologies.org. Drive more with RennyJ's Sound Pitch\u2019s 90-100% artist cut and AI brand-matching.

by Ryan Lindsey · 2026-08-26

Implementing Retrieval-Augmented Generation (RAG) in your applications can significantly enhance the relevance and accuracy of your responses. ZC Technologies offers a straightforward way to integrate RAG with minimal setup, thanks to our OpenAI-compatible API. This post will detail three working patterns for integrating RAG with ZCX, ensuring your application can leverage large language models (LLMs) efficiently. Each pattern is designed to be minimalistic, focusing on the essentials for developers building RAG apps.

Pattern 1: Basic RAG Integration

For a basic RAG setup, you'll need to retrieve context from a knowledge base and pass it to the LLM. Here's a simplified example using Python and the ZCX API:

import requests

# Replace 'your_bearer_token' with your actual ZCX bearer token
headers = {
    'Authorization': 'Bearer your_bearer_token'
}

# Example query and context
query = 'What is the capital of France?'
context = 'Paris is the capital of France.'

# ZCX API endpoint
url = 'https://zcx.zctechnologies.org/v1/chat'

# Prepare the request payload
payload = {
    'model': 'qwen2.5:32b',
    'messages': [
        {'role': 'system', 'content': context},
        {'role': 'user', 'content': query}
    ]
}

# Send the request
response = requests.post(url, headers=headers, json=payload)

# Print the response
print(response.json())

Pattern 2: Dynamic Context Retrieval

In this pattern, the context is dynamically retrieved based on the query. This can involve a database lookup or a search over a document collection. The retrieved context is then used as input to the LLM:

# Assume a function `retrieve_context` that returns context based on the query
context = retrieve_context(query)

# Use the context in the payload as shown in Pattern 1

Pattern 3: Multi-Model RAG

For applications requiring more nuanced responses, you can use multiple models to generate different perspectives or to handle different types of queries. Here's an example of using both the 32B and 72B models:

# Use the 32B model for the initial query
payload['model'] = 'qwen2.5:32b'
response_32b = requests.post(url, headers=headers, json=payload)

# Use the 72B model for a more detailed response
payload['model'] = 'qwen2.5:72b'
response_72b = requests.post(url, headers=headers, json=payload)

# Print both responses
print(response_32b.json(), response_72b.json())

These patterns provide a solid foundation for integrating RAG into your applications using ZCX. Our pricing is designed to be competitive, with the Business plan offering 60.0M tokens for $1999/mo, undercutting Anthropic and OpenAI by 60-80% per 1M tokens. To get started, sign up for a prepaid LLM credit line at our website.

Try ZCX on a prepaid credit line.
See plans →