Nscale

Nscale (EU Sovereign)

https://docs.nscale.com/docs/inference/chat

모든 Nscale 모델을 지원해요. litellm 요청 시 model=nscale/<any-model-on-nscale>처럼 접두어로 nscale/를 붙이면 돼요.

속성 내용
설명 LLM과 이미지 생성을 위한 유럽 소재 풀스택 AI 클라우드 플랫폼
LiteLLM 제공자 라우트 nscale/
지원 엔드포인트 /chat/completions, /images/generations
API 레퍼런스 Nscale docs

필요한 변수 (Required Variables)

환경 변수

os.environ["NSCALE_API_KEY"] = ""  # your Nscale API key

사용 가능한 모델 둘러보기 (Explore Available Models)

매우 경쟁력 있는 가격으로 제공되는 텍스트 및 멀티모달 AI 모델의 전체 목록을 둘러보세요: 📚 Full List of Models

주요 기능 (Key Features)

  • EU Sovereign: 완전한 데이터 주권과 유럽 규정 준수
  • 초저비용 (Ultra-Low Cost, $0.01 / M tokens부터): 텍스트와 이미지 생성 모델 모두 매우 경쟁력 있는 가격
  • 프로덕션급 (Production Grade): 완전한 격리를 갖춘 신뢰할 수 있는 서버리스 배포
  • 설정 불필요 (No Setup Required): 인프라 관리 없이 컴퓨팅에 즉시 접근
  • 완전한 제어 (Full Control): 데이터는 비공개로 유지되고 격리됨

사용법 - LiteLLM Python SDK

텍스트 생성 (Text Generation)

Nscale 텍스트 생성

from litellm import completion
import os

os.environ["NSCALE_API_KEY"] = ""  # your Nscale API key
response = completion(
    model="nscale/meta-llama/Llama-4-Scout-17B-16E-Instruct",
    messages=[{"role": "user", "content": "What is LiteLLM?"}]
)
print(response)

Nscale 텍스트 생성 - 스트리밍

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)

Nscale 이미지 생성

from litellm import image_generation
import os

os.environ["NSCALE_API_KEY"] = ""  # your Nscale API key
response = image_generation(
    model="nscale/stabilityai/stable-diffusion-xl-base-1.0",
    prompt="A beautiful sunset over mountains",
    n=1,
    size="1024x1024"
)
print(response)

사용법 - LiteLLM Proxy

LiteLLM Proxy 설정 파일에 다음을 추가해 주세요:

config.yaml

model_list:
  - model_name: nscale/meta-llama/Llama-4-Scout-17B-16E-Instruct
    litellm_params:
      model: nscale/meta-llama/Llama-4-Scout-17B-16E-Instruct
      api_key: os.environ/NSCALE_API_KEY
  - model_name: nscale/meta-llama/Llama-3.3-70B-Instruct
    litellm_params:
      model: nscale/meta-llama/Llama-3.3-70B-Instruct
      api_key: os.environ/NSCALE_API_KEY
  - model_name: nscale/stabilityai/stable-diffusion-xl-base-1.0
    litellm_params:
      model: nscale/stabilityai/stable-diffusion-xl-base-1.0
      api_key: os.environ/NSCALE_API_KEY

LiteLLM Proxy 서버를 시작해 주세요:

litellm --config config.yaml

# RUNNING on http://0.0.0.0:4000
  • OpenAI SDK
  • LiteLLM SDK
  • cURL

Proxy를 통한 Nscale - 비스트리밍

from openai import OpenAI

# Initialize client with your proxy URL
client = OpenAI(
    base_url="http://localhost:4000",  # Your proxy URL
    api_key="your-proxy-api-key"       # Your proxy API key
)

# Non-streaming response
response = client.chat.completions.create(
    model="nscale/meta-llama/Llama-4-Scout-17B-16E-Instruct",
    messages=[{"role": "user", "content": "What is LiteLLM?"}]
)

print(response.choices[0].message.content)

Proxy를 통한 Nscale - LiteLLM SDK

import litellm

# Configure LiteLLM to use your proxy
response = litellm.completion(
    model="litellm_proxy/nscale/meta-llama/Llama-4-Scout-17B-16E-Instruct",
    messages=[{"role": "user", "content": "What is LiteLLM?"}],
    api_base="http://localhost:4000",
    api_key="your-proxy-api-key"
)

print(response.choices[0].message.content)

Proxy를 통한 Nscale - cURL

curl http://localhost:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-p...-key" \
  -d '{
    "model": "nscale/meta-llama/Llama-4-Scout-17B-16E-Instruct",
    "messages": [{"role": "user", "content": "What is LiteLLM?"}]
  }'

시작하기 (Getting Started)

  • console.nscale.com에서 계정 생성
  • 무료 크레딧 받기
  • 설정에서 API 키 생성
  • LiteLLM을 사용해 API 호출 시작

추가 자료 (Additional Resources)

  • Nscale Documentation
  • Blog: Sovereign Serverless

출처: 문서

본문

더 알아보기 (Learn more)