Quickstart
Welcome to the Oraicle API documentation. Our API provides access to state-of-the-art language models with a simple, OpenAI-compatible interface.
Base URL
Section titled “Base URL”https://api.oraicle.me/v1
Quick Start
Section titled “Quick Start”Here’s how to make your first API call in various programming languages:
from openai import OpenAI
# Set your API key and base URLclient = 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 requestresponse = 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)
import { OpenAI } from "openai";
// Set up the client with your API key and base URLconst openai = new OpenAI({ apiKey: "<your_api_key>", baseURL: "https://api.oraicle.me/v1"});
async function callAPI() { const completion = await openai.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." } ], });
console.log(completion.choices[0].message.content);}
callAPI();
curl https://api.oraicle.me/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <your_api_key>" \ -d '{ "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." } ] }'
import com.theokanning.openai.completion.chat.ChatCompletionRequest;import com.theokanning.openai.completion.chat.ChatMessage;import com.theokanning.openai.completion.chat.ChatMessageRole;import com.theokanning.openai.service.OpenAiService;import retrofit2.Retrofit;
import java.time.Duration;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;
public class OraicleExample { public static void main(String[] args) { String token = "<your_api_key>"; String baseUrl = "https://api.oraicle.me/v1";
// Create a service with custom base URL OpenAiService service = new OpenAiService(token, Duration.ofSeconds(30), baseUrl);
List messages = new ArrayList<>(); messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "You are a smarter assistant.")); messages.add(new ChatMessage(ChatMessageRole.USER.value(), "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."));
ChatCompletionRequest completionRequest = ChatCompletionRequest.builder() .model("deepseek-ai/DeepSeek-R1") .messages(messages) .build();
service.createChatCompletion(completionRequest) .getChoices() .forEach(choice -> System.out.println(choice.getMessage().getContent())); }}
using System;using System.Collections.Generic;using System.Net.Http;using System.Text;using System.Text.Json;using System.Threading.Tasks;
class Program{ static async Task Main(string[] args) { var apiKey = "<your_api_key>"; var baseUrl = "https://api.oraicle.me/v1";
using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
var requestData = new { model = "deepseek-ai/DeepSeek-R1", messages = new[] { new { role = "system", content = "You are a smarter assistant." }, new { 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." } } };
var content = new StringContent( JsonSerializer.Serialize(requestData), Encoding.UTF8, "application/json");
var response = await client.PostAsync($"{baseUrl}/chat/completions", content); var responseBody = await response.Content.ReadAsStringAsync();
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; var result = JsonSerializer.Deserialize(responseBody, options);
Console.WriteLine(result.Choices[0].Message.Content); }}
class CompletionResponse{ public Choice[] Choices { get; set; }}
class Choice{ public Message Message { get; set; }}
class Message{ public string Content { get; set; }}
package main
import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http")
type ChatCompletionRequest struct { Model string `json:"model"` Messages []Message `json:"messages"`}
type Message struct { Role string `json:"role"` Content string `json:"content"`}
type ChatCompletionResponse struct { Choices []Choice `json:"choices"`}
type Choice struct { Message Message `json:"message"`}
func main() { apiKey := "<your_api_key>" baseURL := "https://api.oraicle.me/v1"
// Create request body reqBody := ChatCompletionRequest{ Model: "deepseek-ai/DeepSeek-R1", Messages: []Message{ {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."}, }, }
// Marshal the request body to JSON jsonData, err := json.Marshal(reqBody) if err != nil { fmt.Println("Error marshaling JSON:", err) return }
// Create HTTP request req, err := http.NewRequest("POST", baseURL+"/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { fmt.Println("Error creating request:", err) return }
// Set headers req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+apiKey)
// Send the request client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close()
// Read the response body body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response:", err) return }
// Parse the response var result ChatCompletionResponse if err := json.Unmarshal(body, &result); err != nil { fmt.Println("Error parsing response:", err) return }
// Print the assistant's reply fmt.Println(result.Choices[0].Message.Content)}
<?php$apiKey = '<your_api_key>';$baseUrl = 'https://api.oraicle.me/v1';
$data = [ '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.' ] ]];
$headers = [ 'Content-Type: application/json', 'Authorization: Bearer ' . $apiKey];
$ch = curl_init($baseUrl . '/chat/completions');curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);curl_close($ch);
if ($httpStatus === 200) { $responseData = json_decode($response, true); echo $responseData['choices'][0]['message']['content'];} else { echo "Error: " . $httpStatus . "\n" . $response;}?>
Response:
{ "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 } ]}