Registry / llm-agents / writer-sdk

writer-sdk

JSON →
library3.0.0pypypi✓ verified 86d ago

The writer-sdk is the official Python library for the Writer API, providing programmatic access to Writer's generative AI capabilities. It enables Python 3.9+ applications to integrate features like chat completions, text generation, and knowledge graph interactions. The library is actively maintained with frequent updates, including a recent release candidate for version 3.0.0.

pip install writer-sdk
INSTALL
IMPORT
SIG · WRITER-SDK
W
writer-sdk
llm-agentspythonv3.0.0
Install
4.5s avg
Import
959ms
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.0rc1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 1.002s · 35.5MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 4.5s · import 0.917s · 35MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Writer
from writerai import Writer
from writer_sdk import Writer
The primary client class is imported from 'writerai', not 'writer_sdk'.

This quickstart demonstrates how to initialize the Writer client and make a basic chat completion request. It emphasizes using the `WRITER_API_KEY` environment variable for secure authentication.

import os from writerai import Writer # Initialize the Writer client. # The API key will be inferred from the `WRITER_API_KEY` environment variable. # Ensure you have 'export WRITER_API_KEY="your-api-key"' in your environment # or pass it explicitly: client = Writer(api_key="your-api-key") client = Writer(api_key=os.environ.get("WRITER_API_KEY", "")) if not client.api_key: print("WARNING: WRITER_API_KEY environment variable not set. Please set it for authentication.") print("You can obtain your API key from your Writer AI Studio account settings.") else: try: response = client.chat.chat( messages=[{ "content": "Write a short poem about Python", "role": 'user' }], model="palmyra-x5" ) print(response.choices[0].message.content) except Exception as e: print(f"An error occurred: {e}")
writer --version
Debug
Known issues
breakingVersion 3.0.0-rc1 deprecates several API features, including AI Detection, Medical Comprehend, and Context-Aware Text Splitting. Applications relying on these specific endpoints will break upon upgrade to v3.0.0.
fix
Review the v3.0.0-rc1 changelog and update your code to remove usage of deprecated features or use alternative Writer API capabilities.
affects: >=3.0.0-rc1
breakingThe 2.0.0 release introduced breaking changes to the underlying models used in chat completion. This primarily affects users directly importing specific types related to chat completion models.
fix
If you encounter type-related errors after upgrading to v2.0.0+, review the updated type definitions in the SDK or limit usage to the `client.chat.chat` method without direct type imports.
affects: >=2.0.0
gotchaThe `writer-sdk` library should not be confused with the `writer` PyPI package, which corresponds to `writer-framework`. They are distinct libraries with different purposes, where `writer-framework` is for building UI-based AI applications.
fix
Ensure you are installing `writer-sdk` for the API client and `writer` for the framework, and import accordingly. The SDK's client is typically imported as `from writerai import Writer`.
affects: All
gotchaAPI keys should not be hard-coded in your application. The library automatically infers the API key from the `WRITER_API_KEY` environment variable.
fix
Set the `WRITER_API_KEY` environment variable before running your application (e.g., `export WRITER_API_KEY="your-api-key"`) or use a `.env` file for local development. Alternatively, pass it explicitly to the client constructor (e.g., `client = Writer(api_key=os.environ.get('WRITER_API_KEY'))`).
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'writerai'
The `writer-sdk` package is either not installed, or the import statement is incorrect.
fix
Ensure the library is installed with `pip install writer-sdk` and that your import statement is `from writerai import Writer`.
writerai.APIStatusError: 401 Unauthorized
The provided API key is invalid, missing, or expired.
fix
Verify that your `WRITER_API_KEY` environment variable is set correctly with a valid API key from your Writer AI Studio account. Ensure there are no leading/trailing spaces or incorrect characters.
writerai.APIConnectionError: Connection error
The client could not connect to the Writer API, possibly due to network issues, a timeout, or a firewall blocking the connection.
fix
Check your internet connection, firewall settings, and ensure that `https://api.writer.com/v1` is accessible. Increase client timeout if necessary.
AttributeError: 'Writer' object has no attribute 'some_method'
You are attempting to call an API method that does not exist in your installed SDK version, or the method name has changed in a newer version. This can also happen if a service/feature was deprecated.
fix
Refer to the official Writer SDK documentation for the correct API calls for your installed version. Upgrade your `writer-sdk` to the latest version to access new features, and review changelogs for breaking changes if upgrading across major versions.
Upgrade
Version history
3.0.0latest on PyPI · released Jun 2, 2026
Audit
Dependencies
PythonrequiredRequires Python 3.9 or higher for compatibility.
Agent activity
47 hits · last 30 days
node
42
Perplexity
1
OpenAI (training)
1
Resources
writer-sdk — pip install writer-sdk · libregistry