Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Change the base URL to https://api.cometapi.com/v1 when you use OpenAI-compatible SDKs or endpoints. Keep the endpoint path and request body format from the API reference, then use your CometAPI API key.

Use the correct base URL

The OpenAI-compatible base URL is:
https://api.cometapi.com/v1

Python base URL

The following Python example changes only the client configuration:
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["COMETAPI_KEY"],
    base_url="https://api.cometapi.com/v1",
)

Node.js base URL

The following Node.js example sets the CometAPI base URL:
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.COMETAPI_KEY,
  baseURL: "https://api.cometapi.com/v1",
});

Test the change

The following request verifies that the base URL and API key work:
curl https://api.cometapi.com/v1/chat/completions \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-model-id",
    "messages": [
      {
        "role": "user",
        "content": "Say hello in one sentence."
      }
    ]
  }'
A successful response returns a chat completion object:
{
  "object": "chat.completion",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello from CometAPI."
      }
    }
  ]
}

Common errors

ErrorFix
404Include /v1 in the base URL for OpenAI-compatible endpoints.
HTML instead of JSONCheck whether your HTTP client followed a redirect from a wrong path.
401Use Authorization: Bearer $COMETAPI_KEY.
Management API auth mismatchAPI key management endpoints use a personal access value, not bearer model-request auth.
Last updated: May 27, 2026