1. Prepare your API address and key
- Sign in to the console provided by your administrator.
- Open the API Keys page (console path
/keys), then create and copy an API key. - Confirm that your account and key are active and can access the intended model.
- Confirm your API base URL using the address supplied by your administrator or console.
API_BASE_URL includes one /v1 and has no trailing /. If your deployment uses a path prefix, preserve it, for example https://example.com/gateway/v1. Do not use the documentation domain or add /v1 twice.
Replace YOUR_API_KEY locally. Do not commit a real key to Git, put it in browser code, or expose it in screenshots. Do not substitute a sign-in session or management credential for a model API key.
2. List available models
data array. Each entry’s id is the model ID to use in requests. Choose a chat model that supports Chat Completions and use its exact ID, not its display name.
Replace the placeholder below with that model ID. The following requests use this variable:
3. Send your first chat request
Choose one of the three options below, using the environment variables you set above. Sending a request invokes the actual model.cURL
Requires cURL 7.76 or later. Use the original model ID returned by the model list.Python
Requires Python 3 and uses only the standard library. Save the code aschat.py and run python3 chat.py in the terminal where you set the environment variables.
TypeScript
Requires Node.js 22.18 or later and uses built-infetch; no dependencies are required. Save the code as chat.mts and run node chat.mts in the terminal where you set the environment variables.
4. Check the result
On success, cURL prints JSON with the reply atchoices[0].message.content. The Python and TypeScript examples print that text directly, for example:
Troubleshooting
These are troubleshooting directions; actual status codes and error messages can vary by upstream service.
Next steps
Configure the same API base URL, key, and model ID in your server-side application. When integrating an existing SDK, check whether it expects a base URL containing/v1 or a full endpoint URL.
About the project and address conventions · 切换到简体中文
Integration guides · API reference