You.com Python SDK
raw JSON → 2.3.0 verified Fri May 01 auth: no python
The official Python SDK for You.com, providing access to You.com's AI chat, code generation, and search APIs. Current version 2.3.0, requires Python >=3.10. Follows monthly release cadence.
pip install youdotcom Common errors
error ModuleNotFoundError: No module named 'youdotcom.api' ↓
cause Import path changed in v2.0; youdotcom.api no longer exists.
fix
Use
from youdotcom import YouClient instead. error TypeError: __init__() got an unexpected keyword argument 'api_key' ↓
cause Older SDK expected api_key as positional argument or via env var only.
fix
Upgrade to v2.3.0 which supports
YouClient(api_key='...'). If using older version, set env var YOU_API_KEY. error AttributeError: 'YouClient' object has no attribute 'chat' ↓
cause Trying to access chat endpoint on a non-chat client or older version.
fix
Ensure you are using YouClient (not other clients) and version >=2.0.
error ValueError: API key not provided. Set YOU_API_KEY environment variable. ↓
cause Missing API key.
fix
Set environment variable
YOU_API_KEY or pass api_key to YouClient constructor. error pydantic.error_wrappers.ValidationError: 1 validation error for ChatCompletionRequest model field required (type=value_error.missing) ↓
cause model parameter is required since v2.2.0+.
fix
Add
model='gpt-4' (or similar) to the create method call. Warnings
breaking In v2.0, the SDK dropped support for Python 3.9 and below. Upgrade to Python >=3.10. ↓
fix Require Python 3.10+ and upgrade youdotcom to latest.
breaking Import paths changed in v2.0. YouClient and models are now directly under `youdotcom`, not `youdotcom.api` or `youdotcom.models`. ↓
fix Use `from youdotcom import YouClient, ChatCompletion` instead of old submodule imports.
deprecated The method `youclient.chat.completions.create` now requires explicit `model` parameter; default model is deprecated and will be removed. ↓
fix Always specify a model string, e.g., `model='gpt-4'`.
gotcha API key must be set via environment variable `YOU_API_KEY` or passed directly. SDK does not read from .env automatically. ↓
fix Use `YouClient(api_key='your-key')` or export `YOU_API_KEY`.
gotcha The SDK uses httpx internally; proxies and custom timeouts must be configured via httpx client options, not directly on YouClient. ↓
fix Create an httpx.AsyncClient with desired settings and pass it as `http_client` parameter to YouClient/AsyncYouClient.
Imports
- YouClient wrong
from youdotcom.api import YouClientcorrectfrom youdotcom import YouClient - ChatCompletion wrong
from youdotcom.models import ChatCompletioncorrectfrom youdotcom import ChatCompletion - AsyncYouClient wrong
from youdotcom.async_client import AsyncYouClientcorrectfrom youdotcom import AsyncYouClient
Quickstart
import os
from youdotcom import YouClient
client = YouClient(api_key=os.environ.get('YOU_API_KEY', ''))
response = client.chat.completions.create(
model='gpt-4',
messages=[{'role': 'user', 'content': 'Hello, how are you?'}]
)
print(response.choices[0].message.content)