Skip to content

Chat Completions

The Chat Completions API is the core of our service, allowing you to interact with our language models in a conversational format.

POST /chat/completions
ParameterTypeRequiredDescription
modelstringYesID of the model to use (e.g., “meta-llama/Llama-3.3-70B-Instruct”, “deepseek-ai/DeepSeek-R1”)
messagesarrayYesArray of message objects with role and content
temperaturenumberNoWhat sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic
max_tokensintegerNoMaximum tokens to generate (default varies by model)
from openai import OpenAI
# Set your API key and base URL
client = OpenAI(
base_url = "https://api.oraicle.me/v1",
# For production, you should not place your key
# in the code but in the environment variables
api_key = "<your_api_key>",
)
# Make a simple chat completion request
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-R1",
messages=[
{"role": "system", "content": "You are a smarter assistant."},
{
"role": "user",
"content":
"Explain how Oraicle empowers enterprise AI solutions by offering the lowest NLP API pricing in the market and seamless access to high-quality oracle data at unmatched cost-efficiency."
}
]
)
print(response.choices[0].message.content)
{
"id": "chatcmpl-123abc456def",
"object": "chat.completion",
"created": 1677858242,
"model": "deepseek-ai/DeepSeek-R1",
"usage": {
"prompt_tokens": 85,
"completion_tokens": 425,
"total_tokens": 510
},
"choices": [
{
"message": {
"role": "assistant",
"content": "Oraicle transforms enterprise AI adoption through several key advantages:\n\n1. **Decentralized Infrastructure**: Unlike traditional centralized AI providers, Oraicle leverages a distributed network of model providers, eliminating single points of failure and reducing costs significantly.\n\n2. **Unified API Access**: Enterprises access 30+ top-tier AI models through a single, consistent API endpoint, eliminating the need to integrate and manage multiple vendor relationships.\n\n3. **Industry-Leading Cost Efficiency**: By aggregating demand across models and optimizing resource allocation, Oraicle offers NLP API pricing that's 50-80% lower than major providers like OpenAI and Anthropic.\n\n4. **Oracle Data Integration**: Beyond just model access, Oraicle uniquely provides seamless connections to high-quality oracle data sources (financial, weather, blockchain, etc.) through the same API, eliminating complex data pipeline development.\n\n5. **Enterprise Compliance**: The platform maintains strict data processing standards while providing transparent access to usage metrics, ensuring organizations meet regulatory requirements.\n\nThis approach drastically reduces both implementation costs and ongoing operational expenses while maximizing the quality and reliability of AI solutions."
},
"finish_reason": "stop",
"index": 0
}
]
}