Nebul Docs

Quick Start

Make your first request to the Nebul Inference API with the OpenAI SDKs or cURL

The Inference API is OpenAI-compatible. Point an OpenAI SDK at https://api.inference.nebul.io/v1, pass your API key, and call any model in the catalog. This page takes you from a fresh key to a first response, in the language you already use.

Prerequisites

  • A Nebul account with API access. Sign up at Nebul AI Studio.
  • An API key created in AI Studio. Keys start with sk-.
  • Python 3.9 or higher for the Python example; every other tab needs only its OpenAI SDK or an HTTP client.

Export your key in your terminal before running any example on this page:

export NEBUL_API_KEY="sk-your-key"

Keep the key out of your code

Every example here reads the key from the environment. Treat sk- keys like passwords: anyone holding one can spend your project's budget.

Make your first request

Pick a language. Each tab installs the client and sends one chat request to zai-org/GLM-5.3:

pip install openai
import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["NEBUL_API_KEY"],
    base_url="https://api.inference.nebul.io/v1",
)

response = client.chat.completions.create(
    model="zai-org/GLM-5.3",
    messages=[{"role": "user", "content": "Say OK"}],
)

print(response.choices[0].message.content)

You should see the model's answer to your message. If you get a 401, the key is wrong or not exported; a 404 means the model isn't enabled for your project, so swap in one from the list below.

The snippets call zai-org/GLM-5.3. Replace it with any model ID from GET /v1/models or the Model Catalog; IDs look like zai-org/GLM-5.3 and openai/gpt-oss-120b. The SDKs page covers the same setup in more environments, including plain fetch and streaming.

List available models

Every key is scoped to a project, so the list shows what that project can call:

import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["NEBUL_API_KEY"],
    base_url="https://api.inference.nebul.io/v1",
)

for model in client.models.list():
    print(model.id)

One model ID prints per line. Fine-tuned adapters appear too, with IDs starting ft:. To browse models with pricing and context windows instead, use the Model Catalog.

Endpoints

EndpointMethodWhat it doesGuide
/v1/chat/completionsPOSTChat, vision, tools, structured outputChat Completions
/v1/responsesPOSTResponses API with reasoning and streamingResponses
/v1/messagesPOSTAnthropic-compatible Messages APIMessages
/v1/completionsPOSTLegacy text completions—
/v1/embeddingsPOSTVector embeddingsEmbeddings
/v1/rerankPOSTRerank documents by relevanceReranking
/v1/modelsGETList models available to your keyThis page
/v1/model/infoGETModel metadata: pricing, context, reasoning effortsModel Catalog
/v1/audio/transcriptionsPOSTSpeech to textSpeech to Text
/v1/audio/speechPOSTText to speechText to Speech
/v1/ocrPOSTOptical character recognitionOCR
/v1/images/generationsPOSTImage generationImage Models
/v1/images/editsPOSTImage editingImage Models
/v1/images/variationsPOSTImage variationsImage Models
/v1/filesGET/POSTUpload files for prompts and fine-tuningFiles API

Error handling

Errors come in two shapes. Middleware errors (authentication, routing, limits, budgets) return {"detail": {"message", "error_type"}}. Errors raised inside the model backend use the OpenAI shape {"error": {"message", "type", "param", "code"}}:

{
  "detail": {
    "message": "Invalid API key provided",
    "error_type": "unauthorized_error"
  }
}
CodeMeaning
400Malformed request body, invalid parameters, or a guardrail blocked the prompt
401Invalid or missing API key
404Model not found, or not enabled for your project; see the Model Catalog
429Rate limit exceeded, or the project's monthly budget is spent (see limits)
499Client disconnected before the request completed
500Server error; retry the request

Every status code, response body, and retry rule is covered in Errors.

Next steps

  • Examples: streaming, embeddings, vision, tools, and reasoning
  • SDKs: the same setup in Python, TypeScript, JavaScript, Go, Rust, Java, C++, and the shell
  • Model Catalog: browse models with pricing and context windows
  • Rate Limits: limits, budgets, and how to handle them
  • API Reference: full OpenAPI specification

On this page