VOOZH about

URL: https://docs.litellm.ai/docs/providers/nebius

⇱ Nebius AI Studio | liteLLM


Skip to main content

https://docs.nebius.com/studio/inference/quickstart

tip

**Litellm provides support to all models from Nebius AI Studio. To use a model, set model=nebius/<any-model-on-nebius-ai-studio> as a prefix for litellm requests. The full list of supported models is provided at https://studio.nebius.ai/ **

API Key

import os
# env variable
os.environ['NEBIUS_API_KEY']

Sample Usage: Text Generation

from litellm import completion
import os

os.environ['NEBIUS_API_KEY']="insert-your-nebius-ai-studio-api-key"
response = completion(
model="nebius/Qwen/Qwen3-235B-A22B",
messages=[
{
"role":"user",
"content":"What character was Wall-e in love with?",
}
],
max_tokens=10,
response_format={"type":"json_object"},
seed=123,
stop=["\n\n"],
temperature=0.6,# either set temperature or `top_p`
top_p=0.01,# to get as deterministic results as possible
tool_choice="auto",
tools=[],
user="user",
)
print(response)

Sample Usage - Streaming

from litellm import completion
import os

os.environ['NEBIUS_API_KEY']=""
response = completion(
model="nebius/Qwen/Qwen3-235B-A22B",
messages=[
{
"role":"user",
"content":"What character was Wall-e in love with?",
}
],
stream=True,
max_tokens=10,
response_format={"type":"json_object"},
seed=123,
stop=["\n\n"],
temperature=0.6,# either set temperature or `top_p`
top_p=0.01,# to get as deterministic results as possible
tool_choice="auto",
tools=[],
user="user",
)

for chunk in response:
print(chunk)

Sample Usage - Embedding

from litellm import embedding
import os

os.environ['NEBIUS_API_KEY']=""
response = embedding(
model="nebius/BAAI/bge-en-icl",
input=["What character was Wall-e in love with?"],
)
print(response)

Usage with LiteLLM Proxy Server

Here's how to call a Nebius AI Studio model with the LiteLLM Proxy Server

  1. Modify the config.yaml
model_list:
-model_name: my-model
litellm_params:
model: nebius/<your-model-name># add nebius/ prefix to use Nebius AI Studio as provider
api_key: api-key # api key to send your model
  1. Start the proxy
$ litellm --config /path/to/config.yaml
  1. Send Request to LiteLLM Proxy Server
  • OpenAI Python v1.0.0+
  • curl
import openai
client = openai.OpenAI(
api_key="litellm-proxy-key",# pass litellm proxy key, if you're using virtual keys
base_url="http://0.0.0.0:4000"# litellm-proxy-base url
)

response = client.chat.completions.create(
model="my-model",
messages =[
{
"role":"user",
"content":"What character was Wall-e in love with?"
}
],
)

print(response)
curl --location 'http://0.0.0.0:4000/chat/completions' \
--header 'Authorization: litellm-proxy-key' \
--header 'Content-Type: application/json' \
--data '{
"model": "my-model",
"messages": [
{
"role": "user",
"content": "What character was Wall-e in love with?"
}
],
}'

Supported Parameters

The Nebius provider supports the following parameters:

Chat Completion Parameters

ParameterTypeDescription
frequency_penaltynumberPenalizes new tokens based on their frequency in the text
function_callstring/objectControls how the model calls functions
functionsarrayList of functions for which the model may generate JSON inputs
logit_biasmapModifies the likelihood of specified tokens
max_tokensintegerMaximum number of tokens to generate
nintegerNumber of completions to generate
presence_penaltynumberPenalizes tokens based on if they appear in the text so far
response_formatobjectFormat of the response, e.g., {"type": "json"}
seedintegerSampling seed for deterministic results
stopstring/arraySequences where the API will stop generating tokens
streambooleanWhether to stream the response
temperaturenumberControls randomness (0-2)
top_pnumberControls nucleus sampling
tool_choicestring/objectControls which (if any) function to call
toolsarrayList of tools the model can use
userstringUser identifier

Embedding Parameters

ParameterTypeDescription
inputstring/arrayText to embed
userstringUser identifier

Error Handling

The integration uses the standard LiteLLM error handling. Common errors include:

  • Authentication Error: Check your API key
  • Model Not Found: Ensure you're using a valid model name
  • Rate Limit Error: You've exceeded your rate limits
  • Timeout Error: Request took too long to complete