Skip to main content
CID222Documentation

Python SDK

The official CID222 Python SDK for integrating content safety into your Python applications.

Coming Soon

The Python SDK is currently under development. Check back soon for updates, or use the REST API directly in the meantime.

Planned Features

  • Async Support — Full async/await support with asyncio
  • Type Hints — Complete type annotations for IDE support
  • Streaming — Native generator-based streaming
  • Auto-retry — Built-in retry logic with exponential backoff
  • Pydantic Models — Request/response validation

API Preview

Here's a preview of what the SDK will look like:

from cid222 import CID222

client = CID222(api_key="your-api-key")

# Simple chat completion
response = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {"role": "user", "content": "Hello, world!"}
    ]
)

print(response.choices[0].message.content)

# Async streaming
async for chunk in client.chat.completions.create(
    model="gpt-4",
    messages=[...],
    stream=True
):
    print(chunk.choices[0].delta.content, end="")

Current Alternative

While the SDK is in development, you can use the REST API directly with the requests library:

import requests
import os

response = requests.post(
    'https://api.cid222.ai/chat/completions',
    headers={
        'Authorization': f'Bearer {os.environ["CID222_API_KEY"]}',
        'Content-Type': 'application/json',
    },
    json={
        'model': 'gpt-4',
        'messages': [
            {'role': 'user', 'content': 'Hello, world!'}
        ]
    }
)

data = response.json()
print(data['choices'][0]['message']['content'])

See the Integration Examples for more Python code samples.