> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudsome-inc.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 스트리밍

모든 채팅 완성 엔드포인트는 stream: true를 통한 스트리밍을 지원합니다. 토큰은 SSE(서버 전송 이벤트)로 실시간 전달됩니다.

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.cloudsome-inc.ai/v1",
    api_key="sk_live_...",
)

response = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)

for chunk in response:
    for choice in chunk.choices:
        if choice.delta.content:
            print(choice.delta.content, end="")
```

## 스트리밍 과금 규칙

* 데이터가 스트리밍되기 전에 업스트림에서 오류가 발생하면 전액 환불됩니다.
* 스트리밍이 시작된 후 연결이 끊기면 가능한 경우 실제 발생한 사용량으로 정산합니다. 정확한 사용량을 확인할 수 없으면 생성된 콘텐츠를 기준으로 추정합니다.
* 업스트림이 스트리밍 중에 실패하면 가능한 경우 실제 발생한 사용량으로 정산합니다. 정확한 사용량을 확인할 수 없으면 수신된 부분 응답을 기준으로 추정합니다.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.