Nebius AI Studio offers an OpenAI-compatible API for inference and fine-tuning.
Here are examples of Python, cURL and JavaScript SDK command that makes an API request from your terminal:
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.studio.nebius.com/v1/",
    api_key=os.environ.get("NEBIUS_API_KEY"),
)

completion = client.chat.completions.create(
    model="meta-llama/Meta-Llama-3.1-70B-Instruct",
    messages=[
        {
            "role": "user",
            "content": """Hello!"""
        }
    ],
    temperature=0.6
)

print(completion.to_json())
For more examples, see Examples of using the Nebius AI Studio API.

Authentication

To authenticate, include your API key (e.g., ABC123...) in the Authorization header, as shown below:
Authorization: Bearer ABC123...
Keep your keys private; do not share or expose them in client-side code. If a key is compromised, Nebius AI Studio can automatically revoke it
To get an API key:
  1. In Nebius AI Studio, go to the  API keys section.
  2. Click  Create API key.
  3. Enter the key name and then click Create.
  4. Save the displayed API key. You cannot open it later in Nebius AI Studio.
In the Nebius AI Studio inference playground, you can view your model setup and chat as code that makes API requests, and use this code in your applications. For more details, see View code.
You can use integrations with third-party instruments instead of the API.