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 openaiimport 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
| Endpoint | Method | What it does | Guide |
|---|---|---|---|
/v1/chat/completions | POST | Chat, vision, tools, structured output | Chat Completions |
/v1/responses | POST | Responses API with reasoning and streaming | Responses |
/v1/messages | POST | Anthropic-compatible Messages API | Messages |
/v1/completions | POST | Legacy text completions | — |
/v1/embeddings | POST | Vector embeddings | Embeddings |
/v1/rerank | POST | Rerank documents by relevance | Reranking |
/v1/models | GET | List models available to your key | This page |
/v1/model/info | GET | Model metadata: pricing, context, reasoning efforts | Model Catalog |
/v1/audio/transcriptions | POST | Speech to text | Speech to Text |
/v1/audio/speech | POST | Text to speech | Text to Speech |
/v1/ocr | POST | Optical character recognition | OCR |
/v1/images/generations | POST | Image generation | Image Models |
/v1/images/edits | POST | Image editing | Image Models |
/v1/images/variations | POST | Image variations | Image Models |
/v1/files | GET/POST | Upload files for prompts and fine-tuning | Files 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"
}
}| Code | Meaning |
|---|---|
400 | Malformed request body, invalid parameters, or a guardrail blocked the prompt |
401 | Invalid or missing API key |
404 | Model not found, or not enabled for your project; see the Model Catalog |
429 | Rate limit exceeded, or the project's monthly budget is spent (see limits) |
499 | Client disconnected before the request completed |
500 | Server 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