Install the SDK
The following command installs the OpenAI Python SDK:Python client
The following Python example creates a CometAPI client and sends a chat request:Node.js client
The following Node.js example usesbaseURL with the OpenAI SDK:
Common errors
| Error | Fix |
|---|---|
401 | Confirm that COMETAPI_KEY is set and that the request uses Bearer auth. |
| SDK still calls OpenAI | Set base_url in Python or baseURL in Node.js. |
| Invalid model ID | Choose a model ID from the Models page. |
Missing /v1 | Use https://api.cometapi.com/v1 for OpenAI-compatible SDKs. |