Using RIFX via API
To start using RIFX through API, you can call our API in the following ways:
# Send POST request using requests library
response = requests. post (
url = " https://api.rifx.online/v1/chat/completions " ,
" Authorization " : f "Bearer {RIFX_API_KEY} " # Authorize using your API key
" model " : " gpt-4o-mini " , # Specify the model to use
" role " : " user " , # Message role
" content " : " What is the purpose of existence? " # User input content
// Send POST request using fetch API
fetch ( " https://api.rifx.online/v1/chat/completions " , {
" Authorization " : ` Bearer ${ RIFX_API_KEY } ` , // Authorize using your API key
" Content-Type " : " application/json " // Specify request body content type
" model " : " gpt-4o-mini " , // Specify the model to use
" role " : " user " , // Message role
" content " : " What is the purpose of existence? " // User input content
# Send POST request using curl command
curl https://api.rifx.online/v1/chat/completions \
-H " Content-Type: application/json " \
-H " Authorization: Bearer $RIFX_API_KEY " \
"content": "What is the purpose of existence?"
Using OpenAI Client API
You can also interact with RIFX API using OpenAI’s client API. Here are examples in Python and TypeScript:
from openai import OpenAI
# Get API key from environment variable RIFX_API_KEY
base_url = " https://api.rifx.online/v1 " ,
api_key = getenv ( " RIFX_API_KEY " ) ,
# Send request using OpenAI client library
completion = client.chat.completions. create (
model = " gpt-4o-mini " , # Specify the model to use
" role " : " user " , # Message role
" content " : " What is the purpose of existence? " # User input content
print ( completion.choices [ 0 ] .message.content )
import OpenAI from " openai " ;
// Set up OpenAI API client
const openai = new OpenAI ( {
baseURL: " https://api.rifx.online/v1 " ,
apiKey: process . env . RIFX_API_KEY
// Send request using OpenAI client library
const completion = await openai . chat . completions . create ( {
model: " gpt-4o-mini " , // Specify the model to use
role: " user " , // Message role
content: " What is the purpose of existence? " // User input content
console . log (completion . choices [ 0 ] . message );
Important Notes
API Key : Ensure you have obtained a valid RIFX API key and store it securely.
Error Handling : In production applications, it’s recommended to add error handling logic to properly manage request failures.
Model Selection : Choose appropriate models based on your needs; gpt-4o-mini
is an example model.
With these examples, you can quickly integrate RIFX API into your applications. Choose the implementation method that best suits your programming language and requirements.