
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
The official Python library for the Chat Nio API
Install using pip
.. code-block:: bash
pip install --upgrade chatnio
And then import it
.. code-block:: python
import chatnio
.. code-block:: python
chatnio.set_key("sk-...")
# or read from environment variable
chatnio.set_key_from_env("CHATNIO_TOKEN")
# set custom api endpoint (default: https://api.chatnio.net)
# chatnio.set_endpoint("https://example.com/api")
# clear token
chatnio.clear_key()
# get current token
chatnio.get_token()
.. code-block:: python
chat = await chatnio.new_chat()
async for message in chat.ask("Hello, world!"):
print(message.message, end="")
.. code-block:: python
# list conversations (100 conversations max)
for conversation in chatnio.list_conversations():
print(conversation.id, conversation.name)
# load conversation
conversation = chatnio.load_conversation(42)
print(conversation)
for message in conversation.messages:
print(message.role, message.content)
# delete conversation
state = chatnio.delete_conversation(42)
print(state)
.. code-block:: python
# get quota
quota = chatnio.get_quota()
print(quota)
# buy quota
state = chatnio.buy_quota(1000)
print(state)
.. code-block:: python
# get subscription
subscription = chatnio.get_subscription()
print(subscription.is_subscribed, subscription.expired)
# buy subscription
state = chatnio.buy_subscription(1, 1) # 1 month of basic plan
print(state)
# get package
package = chatnio.get_package()
print(package)
Error
chatnio.AuthenticationError
To run the tests, you need to set the environment variable CHATNIO_TOKEN
to your secret key.
.. code-block:: bash
export CHATNIO_TOKEN="sk-..."
Then run the tests
.. code-block:: bash
pytest
FAQs
The official Python library for the Chat Nio API
We found that chatnio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.