| 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. |
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.
- 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 ?? '');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(plusverbose), 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
- 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_idquery param when your auth model requires scoping requests to a specific project.
- Read
references/basics.mdfor auth, base URL,ai_project_id, and key migration notes. - Read
references/endpoints.mdfor an endpoint map and implementation notes. - Read
references/datasets-and-operations.mdfor dataset uploads + operations workflow. - Run
scripts/nebius-smoke-test.mjsto validate an API key against/modelsand/chat/completions.