Skip to content

Quick Start

Using RIFX via API

To start using RIFX through API, you can call our API in the following ways:

import requests
import json
# Send POST request using requests library
response = requests.post(
url="https://api.rifx.online/v1/chat/completions",
headers={
"Authorization": f"Bearer {RIFX_API_KEY}" # Authorize using your API key
},
data=json.dumps({
"model": "gpt-4o-mini", # Specify the model to use
"messages": [
{
"role": "user", # Message role
"content": "What is the purpose of existence?" # User input content
}
]
})
)

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
from os import getenv
# Get API key from environment variable RIFX_API_KEY
client = OpenAI(
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
messages=[
{
"role": "user", # Message role
"content": "What is the purpose of existence?" # User input content
}
]
)
# Print response
print(completion.choices[0].message.content)

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.