Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Add nscale support for streaming (#10698)

Tom Matthewse2a9cd0c75f3
diff --git a/docs/my-website/docs/providers/nscale.md b/docs/my-website/docs/providers/nscale.md
index 5ebd948db62..670d92a517e 100644
--- a/docs/my-website/docs/providers/nscale.md
+++ b/docs/my-website/docs/providers/nscale.md
@@ -67,6 +67,22 @@ response = completion(
print(response)
```
+```python showLineNumbers title="Nscale Text Generation - Streaming"
+from litellm import completion
+import os
+
+os.environ["NSCALE_API_KEY"] = "" # your Nscale API key
+stream = completion(
+ model="nscale/meta-llama/Llama-4-Scout-17B-16E-Instruct",
+ messages=[{"role": "user", "content": "What is LiteLLM?"}],
+ stream=True
+)
+
+for chunk in stream:
+ if chunk.choices[0].delta.content is not None:
+ print(chunk.choices[0].delta.content, end="")
+```
+
### Image Generation
```python showLineNumbers title="Nscale Image Generation"
diff --git a/litellm/llms/nscale/chat/transformation.py b/litellm/llms/nscale/chat/transformation.py
index 2f7619c13e6..6103b8e3c49 100644
--- a/litellm/llms/nscale/chat/transformation.py
+++ b/litellm/llms/nscale/chat/transformation.py
@@ -41,4 +41,12 @@ class NscaleConfig(OpenAIGPTConfig):
"n",
"temperature",
"top_p",
+ "stream",
+ "logprobs",
+ "top_logprobs",
+ "frequency_penalty",
+ "presence_penalty",
+ "response_format",
+ "stop",
+ "logit_bias",
]