| name | nebius-api |
| description | Implement and maintain integrations with Nebius Token Factory (tokenfactory.nebius.com) OpenAI-compatible API, including auth + base URL config, chat/completions/embeddings/images, model discovery, batch, files, fine-tuning, custom models, and datasets/operations. Use when adding a Nebius provider adapter/client in TypeScript/JavaScript/Python or configuring OpenAI-compatible tooling (OpenAI SDK, LangChain, LiteLLM, etc.) to target Nebius. |
Nebius API (Token Factory)
Overview
Use Nebius Token Factory’s OpenAI-compatible API for inference and post-training: chat/completions/embeddings/images, model listing, batch, files, fine-tuning, custom models, and datasets/operations.
Quick Start (OpenAI-compatible)
- Create an API key in the Token Factory console.
- Use base URL
https://api.tokenfactory.nebius.com/v1/.
- Send OpenAI-compatible requests (prefer reusing the OpenAI SDK; fall back to raw HTTP for non-SDK endpoints like datasets/operations).
TypeScript (Node, OpenAI SDK):
import OpenAI from 'openai';
const apiKey = process.env.NEBIUS_API_KEY;
if (!apiKey) throw new Error('NEBIUS_API_KEY is required');
const client = new OpenAI({
apiKey,
baseURL: 'https://api.tokenfactory.nebius.com/v1/',
});
const res = await client.chat.completions.create({
model: 'meta-llama/Meta-Llama-3.1-70B-Instruct',
messages: [{ role: 'user', content: 'Hello from Nebius' }],
});
console.log(res.choices[0]?.message?.content ?? '');
Capabilities Checklist
Implement these as needed (Nebius is OpenAI-compatible for most of them; some features use additional endpoints):
- Inference:
POST /v1/chat/completions, POST /v1/completions, POST /v1/embeddings, POST /v1/images/generations
- Models:
GET /v1/models (plus verbose), custom models under /v0/models
- Batch:
POST /v1/batches, GET /v1/batches, GET /v1/batches/{id}, POST /v1/batches/{id}/cancel
- Files:
POST /v1/files, GET /v1/files, GET /v1/files/{id}, DELETE /v1/files/{id}, GET /v1/files/{id}/content
- Fine-tuning:
POST /v1/fine_tuning/jobs, GET /v1/fine_tuning/jobs, GET /v1/fine_tuning/jobs/{id}, POST /v1/fine_tuning/jobs/{id}/cancel
- Datasets + operations: multipart upload + dataset CRUD + run/stop operations and inspect checkpoints
Guidance
- Prefer a small provider adapter layer: explicit config (base URL, API key, optional
ai_project_id), typed errors, and pure helper functions for request shaping.
- Treat streaming as SSE: parse
data: frames; terminate on [DONE].
- Use
ai_project_id query param when your auth model requires scoping requests to a specific project.
References
- Read
references/basics.md for auth, base URL, ai_project_id, and key migration notes.
- Read
references/endpoints.md for an endpoint map and implementation notes.
- Read
references/datasets-and-operations.md for dataset uploads + operations workflow.
- Run
scripts/nebius-smoke-test.mjs to validate an API key against /models and /chat/completions.