Quickstart
1. Get a key
Register at api.chinaso.org and create a token.
2. Install the SDK
pip install openai
3. Call the API
from openai import OpenAI
client = OpenAI(
api_key="YOUR_CHINASO_KEY",
base_url="https://api.chinaso.org/v1",
)
completion = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Write a haiku about APIs"}],
stream=False,
)
print(completion.choices[0].message.content)
Streaming
stream = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Count to five"}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content or ""
print(delta, end="")