Quick Start
1. Get Your API Key ποΈ
Visit RapidAPI Hub
Go to RapidAPI AIBoox Page and click βSubscribeβ, choose your plan. We have free tier available.Locate Your Credentials
After subscribing:- Go to RapidAPI AIBoox Page Endpoints - Code Snippets, or My Apps
- In the code snippet provided, locate
X-RapidAPI-Host
andX-RapidAPI-Key
- Combine them into a single string separated by a slash (e.g.,
xxx.p.rapidapi.com/your_key
)
2. SDK Configuration π οΈ
- Requirements:
pip install openai
- https://github.com/openai/openai-python
from openai import OpenAI
# Initialize client with your credentialsclient = OpenAI( base_url="https://llm.aiboox.com/v1", # API endpoint api_key="xxx.p.rapidapi.com/your_rapidapi_key" # APIKey format: Host/Key)
# Create chat completion with streamingresponse = client.chat.completions.create( model="deepseek-v3", # Recommended model messages=[{ "role": "user", "content": "Hello!" # Your prompt }], stream=True # Enable real-time streaming)
# Handle streaming responsefor chunk in response: content = chunk.choices[0].delta.content if content: print(content, end="")
π Important Notes:
We recommend avoiding use the API Code Snippets provided by RapidAPI, as they do not support streaming functionality.
Instead, utilize our dedicated API Endpoint and adhere to our API Key format, which is fully compatible with the OpenAI SDK. Hereβs how:
- Check RapidAPI code snippets to gather both
X-RapidAPI-Host
andX-RapidAPI-Key
. Combine them into a single string for the API key parameter. - API Endpoint:
https://llm.aiboox.com/v1
- API Key:
X-RapidAPI-Host/X-RapidAPI-Key
(e.g.,xxx.p.rapidapi.com/your_key
)
Key Features:
β
Full OpenAI SDK compatibility
π Streaming response support
π§ Customizable parameters:
temperature
(0=strict, 1=creative)max_tokens
(response length control)top_p
(response diversity)
3. cURL Example π
# Basic API Request with Streamingcurl "https://llm.aiboox.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer xxx.p.rapidapi.com/your_rapidapi_key" \ -d '{ "model": "deepseek-v3", "messages": [{ "role": "user", "content": "Hello!" }], "stream": true }'
View Usage Analytics
To monitor your API usage, navigate to the Usage Analytics page.
Input your API key credentials to access detailed statistics, including daily token usage.
Best Practices
- Use RapidAPI code snippets to retrieve both Host and Key values
- Enable streaming for real-time responses
- Handle errors using standard OpenAI SDK patterns
Need help? Contact [email protected]
Last updated: March 8, 2025