By default the library closes underlying HTTP connections whenever the client is garbage collected. You can manually close the client using the .close() method if desired, or with a context manager that closes when exiting.
Just stopping the read from the generator doesn’t stop the network SSE subscription and the model generation.
Now I know that I need to correctly close the stream to stop incurring charges, but I’m not sure how to do it in Python. Do you have any relevant code examples that I can refer to? I would greatly appreciate it.