Get an API key
Go to theAccount Management submenu on the console and open Interface Keys to create a key.
Environment setup
Install Python dependencies
Python users can reuse the OpenAI SDK:Install cURL
Installcurl with your OS package manager:
-
Debian/Ubuntu (
apt): -
CentOS (
yumordnf; CentOS 8+ usesdnf):- With yum:
- With dnf (CentOS 8):
-
macOS (
brew; install Homebrew from brew.sh if needed):
Test a basic API request
Once you have installed the required dependencies and obtained an API key, you can make requests using the Python SDK or curl. Below are simple examples using Python and curl.- python
- curl
copy
Response
The responses for both streaming and non-stream requests are similar to the following:- non-stream
- stream
copy
- Request Timeout Mechanism:A time limit of 10 minutes is set for each request. If a request is not completed within this time limit, the system will stop waiting, immediately terminate the request, and return an error response with status code 503.
- Rate Limiting:The system also enforces rate limits to control the frequency of requests. If a user’s request rate exceeds the allowed limit, the system will not process the excess requests and will instead return an error response with status code 429. This error indicates “Too Many Requests”, meaning that too many requests have been sent within a given time window.