Skip to main content

Nscale

The Nscale provider enables you to use Nscale's Serverless Inference API models with promptfoo. Nscale offers cost-effective AI inference with up to 80% savings compared to other providers, zero rate limits, and no cold starts.

Setup

Set your Nscale service token as an environment variable:

export NSCALE_SERVICE_TOKEN=your_service_token_here

Alternatively, you can add it to your .env file:

NSCALE_SERVICE_TOKEN=your_service_token_here

Obtaining Credentials

You can obtain service tokens by:

  1. Signing up at Nscale
  2. Navigating to your account settings
  3. Going to "Service Tokens" section

Configuration

To use Nscale models in your promptfoo configuration, use the nscale: prefix followed by the model name:

providers:
- nscale:openai/gpt-oss-120b
- nscale:meta-llama/Llama-3.3-70B-Instruct
- nscale:Qwen/Qwen3-235B-A22B-Instruct-2507

Model IDs are the upstream Hugging Face repository IDs and are case-sensitive.

Model Types

Nscale supports different types of models through specific endpoint formats:

Chat Completion Models (Default)

For chat completion models, you can use either format:

providers:
- nscale:chat:openai/gpt-oss-120b
- nscale:openai/gpt-oss-120b # Defaults to chat

Completion Models

For text completion models:

providers:
- nscale:completion:openai/gpt-oss-20b

Embedding Models

For embedding models:

providers:
- nscale:embedding:Qwen/Qwen3-Embedding-8B
- nscale:embeddings:Qwen/Qwen3-Embedding-8B # Alternative format

Text-to-Image Models

For image generation models:

providers:
- nscale:image:black-forest-labs/FLUX.1-schnell

Model IDs are the upstream Hugging Face repository IDs and are case-sensitive (meta-llama/Llama-3.3-70B-Instruct, not meta/llama-3.3-70b-instruct). The authoritative list for your account is GET https://inference.api.nscale.com/v1/models, which also returns pricing and context length:

curl https://inference.api.nscale.com/v1/models \
-H "Authorization: Bearer $NSCALE_SERVICE_TOKEN"

Text Generation Models

ModelProvider FormatUse Case
GPT OSS 120Bnscale:openai/gpt-oss-120bGeneral-purpose reasoning and tasks
GPT OSS 20Bnscale:openai/gpt-oss-20bLightweight general-purpose model
Kimi K2.5nscale:moonshotai/Kimi-K2.5Large-scale agentic reasoning
Qwen 3 235B A22Bnscale:Qwen/Qwen3-235B-A22BLarge-scale language understanding
Qwen 3 235B A22B Instruct 2507nscale:Qwen/Qwen3-235B-A22B-Instruct-2507Latest Qwen 3 235B variant
Qwen 3 4B Instruct 2507nscale:Qwen/Qwen3-4B-Instruct-2507Lightweight instruction following
Qwen 3 4B Thinking 2507nscale:Qwen/Qwen3-4B-Thinking-2507Reasoning and thinking tasks
Qwen 3 8Bnscale:Qwen/Qwen3-8BMid-size general-purpose model
Qwen 3 14Bnscale:Qwen/Qwen3-14BEnhanced reasoning capabilities
Qwen 3 32Bnscale:Qwen/Qwen3-32BLarge-scale reasoning and analysis
Qwen 2.5 Coder 3B Instructnscale:Qwen/Qwen2.5-Coder-3B-InstructLightweight code generation
Qwen 2.5 Coder 7B Instructnscale:Qwen/Qwen2.5-Coder-7B-InstructCode generation and programming
Qwen 2.5 Coder 32B Instructnscale:Qwen/Qwen2.5-Coder-32B-InstructAdvanced code generation
Qwen QwQ 32Bnscale:Qwen/QwQ-32BSpecialized reasoning model
Llama 3.3 70B Instructnscale:meta-llama/Llama-3.3-70B-InstructHigh-quality instruction following
Llama 3.1 8B Instructnscale:meta-llama/Llama-3.1-8B-InstructEfficient instruction following
Llama 3.2 11B Vision Instructnscale:meta-llama/Llama-3.2-11B-Vision-InstructVision-language tasks
Llama 4 Scout 17Bnscale:meta-llama/Llama-4-Scout-17B-16E-InstructImage-Text-to-Text capabilities
DeepSeek R1 Distill Llama 70Bnscale:deepseek-ai/DeepSeek-R1-Distill-Llama-70BEfficient reasoning model
DeepSeek R1 Distill Llama 8Bnscale:deepseek-ai/DeepSeek-R1-Distill-Llama-8BLightweight reasoning model
DeepSeek R1 Distill Qwen 1.5Bnscale:deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5BUltra-lightweight reasoning
DeepSeek R1 Distill Qwen 7Bnscale:deepseek-ai/DeepSeek-R1-Distill-Qwen-7BCompact reasoning model
DeepSeek R1 Distill Qwen 14Bnscale:deepseek-ai/DeepSeek-R1-Distill-Qwen-14BMid-size reasoning model
DeepSeek R1 Distill Qwen 32Bnscale:deepseek-ai/DeepSeek-R1-Distill-Qwen-32BLarge reasoning model
Devstral Small 2505nscale:mistralai/Devstral-Small-2505Code generation and development
Mixtral 8x22B Instructnscale:mistralai/Mixtral-8x22B-Instruct-v0.1Large mixture-of-experts model

Embedding Models

ModelProvider FormatUse Case
Qwen 3 Embedding 8Bnscale:embedding:Qwen/Qwen3-Embedding-8BText embeddings and similarity

Text-to-Image Models

ModelProvider FormatUse Case
Flux.1 Schnellnscale:image:black-forest-labs/FLUX.1-schnellFast image generation
Stable Diffusion XLnscale:image:stabilityai/stable-diffusion-xl-base-1.0High-quality image generation
SDXL Lightningnscale:image:ByteDance/SDXL-LightningUltra-fast image generation

Configuration Options

Nscale supports standard OpenAI-compatible parameters:

providers:
- id: nscale:openai/gpt-oss-120b
config:
temperature: 0.7
max_tokens: 1024
top_p: 0.9
frequency_penalty: 0.1
presence_penalty: 0.2
stop: ['END', 'STOP']
seed: 42

Supported Parameters

  • temperature: Controls randomness (0.0 to 2.0). Defaults to 0 unless set.
  • max_tokens: Maximum number of tokens to generate. Defaults to 1024 unless set.
  • top_p: Nucleus sampling parameter
  • frequency_penalty: Reduces repetition based on frequency
  • presence_penalty: Reduces repetition based on presence
  • stop: Stop sequences to halt generation
  • seed: Deterministic sampling seed

Any other parameter is forwarded to the Nscale API unchanged.

note

Streaming is not supported. Promptfoo reads each response as a single JSON body, so setting stream: true produces a response it cannot parse.

Example Configuration

Here's a complete example configuration:

providers:
- id: nscale:openai/gpt-oss-120b
config:
temperature: 0.7
max_tokens: 512
- id: nscale:meta-llama/Llama-3.3-70B-Instruct
config:
temperature: 0.5
max_tokens: 1024

prompts:
- 'Explain {{concept}} in simple terms'
- 'What are the key benefits of {{concept}}?'

tests:
- vars:
concept: quantum computing
assert:
- type: contains
value: 'quantum'
- type: llm-rubric
value: 'Explanation should be clear and accurate'

Pricing

Nscale offers highly competitive pricing:

  • Text Generation: Starting from $0.01 input / $0.03 output per 1M tokens
  • Embeddings: $0.04 per 1M tokens
  • Image Generation: Starting from $0.0008 per mega-pixel

For the most current pricing information, visit Nscale's pricing page.

Key Features

  • Cost-Effective: Up to 80% savings compared to other providers
  • Zero Rate Limits: No throttling or request limits
  • No Cold Starts: Instant response times
  • Serverless: No infrastructure management required
  • OpenAI Compatible: Standard API interface
  • Global Availability: Low-latency inference worldwide

Error Handling

The Nscale provider includes built-in error handling for common issues:

  • Network timeouts and retries
  • Rate limiting (though Nscale has zero rate limits)
  • Invalid API key errors
  • Model availability issues

Support

For support with the Nscale provider: