Quickstart
From an API key to a fine-tuned model you call with the OpenAI SDK. Every step is the request that performs it, so this page is also the shortest complete integration.
Pick your project type once. Every switch on this page follows that choice:
- Text: train on chat conversations, then call chat completions.
- Embedding: train on query and passage pairs, then call embeddings.
Responses below are trimmed to the fields the next step uses; ids and numbers are examples. The words used here (project, dataset, training job, hosted model, balance) are defined in Core concepts.
Only need a base model?
You do not need a project or training to call a base model. Point the OpenAI SDK
at https://reopenly.com/api/openai/v1; requests are charged to your account.
- Text
- Embedding
from openai import OpenAI
client = OpenAI(base_url="https://reopenly.com/api/openai/v1", api_key="fnf_your_api_key")
response = client.chat.completions.create(
model="ReOpenly/Qwen3.5-9B",
messages=[{"role": "user", "content": "How do returns work?"}],
)
print(response.choices[0].message.content)
from openai import OpenAI
client = OpenAI(base_url="https://reopenly.com/api/openai/v1", api_key="fnf_your_api_key")
response = client.embeddings.create(
model="ReOpenly/Qwen3-Embedding-0.6B", # or ReOpenly/Qwen3-Embedding-4B
input=["text to embed"],
)
print(len(response.data[0].embedding))
See OpenAI-compatible API for everything a base model accepts. The rest of this page trains your own.
1. Get an API key
Create a key in the app, from the profile menu under API keys. The key is shown once, in the response that creates it: ReOpenly stores only a digest, so no listing can return it and nobody can recover it. If you lose it, revoke it and create another. Keep it out of version control.
export REOPENLY_API_KEY="fnf_your_api_key"
export API="https://reopenly.com/api/v1"
Every request sends the key as a bearer token. See Authentication.
2. Check your balance
Training and inference are paid in US dollars from your balance. Read it with
GET /api/v1/credits:
curl "$API/credits" -H "Authorization: Bearer $REOPENLY_API_KEY"
You should see your balance in US dollars (the response also lists your most
recent ledger rows; the field name keeps the word credits for
compatibility):
{"available_credits": 10.0}
A new account starts with the free sign-up balance that
GET /api/v1/pricing/platform publishes as signup_bonus_credits. An account
created with a disposable or temporary email address starts at zero. To add
more, see Add funds. A run starts only
when your balance is above zero and covers its estimate plus a safety margin
(step 5); otherwise step 6 answers 402 insufficient_credits.
3. Create a project
POST /api/v1/projects takes a name and a type. The type is chosen once
and never changes. Or start from an example:
a project that already holds a small public dataset, so you can skip step 4.
- Text
- Embedding
curl "$API/projects" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Support bot", "type": "text"}'
You should see:
{
"status": "created",
"project": {"id": 12, "name": "Support bot", "slug": "support-bot", "type": "text", "owner_slug": "acme"}
}
curl "$API/projects" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Citations", "type": "embedding"}'
You should see:
{
"status": "created",
"project": {"id": 13, "name": "Citations", "slug": "citations", "type": "embedding", "owner_slug": "acme"}
}
Read owner_slug and slug from the response: together they are the project's
address in every later path, written {owner_slug}/{project_slug} on these
pages. The slug is set once from the name and does not change if you rename
the project.
export P="$API/projects/{owner_slug}/{project_slug}"
4. Add training data
- Text
- Embedding
A text project trains on chats: conversations with user and assistant
messages. Add them with POST /api/v1/projects/{owner_slug}/{project_slug}/chats,
the same API the editor uses, so chats you write by hand, send from your own
pipeline or import end up in one place.
curl "$P/chats" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "returns-faq-01",
"tags": ["support"],
"messages": [
{"role": "user", "text": "How do returns work?"},
{"role": "assistant", "text": "Returns are free within 30 days."}
]
}'
You should see:
{
"status": "created",
"chat": {"id": 501, "name": "returns-faq-01", "message_count": 2, "source": "api", "tags": [{"id": 7, "name": "support"}]}
}
Tags are how a run selects its data, so choose them deliberately. Listing the
chats back (GET $P/chats) gives each one's message_count, a durable
updated_at and a nullable source. message_count is computed by the
server, and updated_at moves when the chat, its tags or its messages change.
source is one of csv, api, editor or playground; chats created before
provenance was recorded return null. The server sets source, so an API-key
caller cannot claim a different origin.
An embedding project trains on training pairs: a query (anchor), a
passage that answers it (positive) and, optionally, a passage that looks
related but does not answer it (negative). A new embedding project has a
default dataset. Find its id:
curl "$P/datasets" -H "Authorization: Bearer $REOPENLY_API_KEY"
You should see:
{"data": [{"id": 34, "name": "Default", "kind": "embedding", "is_default": true, "ready_examples": 0}], "total_count": 1}
Add pairs with
POST /api/v1/projects/{owner_slug}/{project_slug}/datasets/{dataset_id}/examples.
A run splits your pairs into training and validation, so one pair is not
enough: this adds three with distinct texts. Pairs that share text always stay
in the same split.
for example in \
'{"anchor":"How long is the warranty on the X200?","positive":"The X200 is covered by a two-year limited warranty.","negative":"The X100 ships with a one-year warranty."}' \
'{"anchor":"How long do I have to return an order?","positive":"You can return an order within thirty days of delivery.","negative":"Standard delivery takes five business days."}' \
'{"anchor":"When is shipping free?","positive":"Orders over fifty dollars qualify for free shipping.","negative":"Express shipping arrives on the next business day."}'
do
curl "$P/datasets/<dataset_id>/examples" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d "$example"
done
Each request answers 201 with the stored pair:
{"id": 9001, "dataset_id": 34, "anchor": "When is shipping free?", "revision": 1, "tag_ids": []}
For more than a handful, import a CSV or JSONL file: see Dataset imports.
5. Estimate the run
An estimate is free and starts nothing. It returns two different numbers: the
estimate, what the run is expected to cost, and the cost ceiling,
the most it may use. To start, your balance must cover required_credits, the
estimate plus a safety margin. You pay only for the training time the run
actually uses.
- Text
- Embedding
Estimate with the tags and settings you will train with:
curl "$P/training-jobs/estimate-messages?tags=support&model_name=ReOpenly/Qwen3.5-9B&num_train_epochs=3" \
-H "Authorization: Bearer $REOPENLY_API_KEY"
You should see:
{
"selected_chats": 3,
"trainable_chats": 3,
"is_trainable": true,
"estimated_gpu_minutes": 1.2,
"estimated_credits": 0.036,
"required_credits": 0.061,
"authorization_credits": 0.15
}
estimated_gpu_minutes and estimated_credits are the forecast;
required_credits is what your balance must cover to start (the forecast plus
a safety margin); authorization_credits is the cost ceiling. All of them are US dollars. is_trainable: false means the
selection has nothing to train on.
An embedding run is planned in three calls. First, the base models and the bounds of every setting:
curl "$P/training-jobs/profiles" -H "Authorization: Bearer $REOPENLY_API_KEY"
{"profiles": [{"base_artifact_id": 3, "max_steps_range": [1, 10000], "profile": {"dimensions": 1024, "max_steps": 100}}]}
Pick a profile and keep its base_artifact_id. Then preview the run with your
dataset, that base and a number of steps:
curl "$P/training-jobs/preview" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"dataset_id": <dataset_id>, "base_artifact_id": <base_artifact_id>, "max_steps": <steps>}'
{"planned_steps_per_epoch": 1, "selection": {"selection_sha256": "4f2a...", "train_count": 2, "eval_count": 1}}
The preview fixes the exact selection and split. Keep
selection.selection_sha256, and set max_steps to a whole number of epochs
(planned_steps_per_epoch times the epochs you want). Then estimate with the
same body:
curl "$P/training-jobs/estimate" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"dataset_id": <dataset_id>, "base_artifact_id": <base_artifact_id>, "max_steps": <steps>}'
{"calibrated": true, "estimated_seconds": 95.0, "estimated_credits": 0.06, "required_credits": 0.06, "admission_ceiling_credits": 0.9}
required_credits is what your balance must cover to start: the estimate with
its safety margin. admission_ceiling_credits is the cost ceiling, the price
of the run's time limit. When the run is outside the range ReOpenly has
measured, calibrated is false, estimated_seconds and estimated_credits
are null (no forecast, not zero), and required_credits is the cost
ceiling.
6. Start training
POST /api/v1/projects/{owner_slug}/{project_slug}/training-jobs starts a run.
The project's type decides which body it accepts.
- Text
- Embedding
curl "$P/training-jobs" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"dataset_tags": ["support"],
"model_name": "ReOpenly/Qwen3.5-9B",
"max_seq_length": 2048,
"num_train_epochs": 3
}'
The run trains on every chat tagged support. Every setting you leave out
takes the base model's default; GET /api/v1/base-models publishes the bounds.
curl "$P/training-jobs" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"dataset_id": <dataset_id>,
"base_artifact_id": <base_artifact_id>,
"max_steps": <steps>,
"selection_sha256": "<selection_sha256>"
}'
selection_sha256 makes the run train on exactly the selection you previewed.
You should see:
{"id": 87, "number": 1, "status": "pending", "model_available": false, "cost_credits": 0.0}
id is the training_job_id used by every later request. number is the
run number the app shows (run 1, 2, 3 in each project); it is not the id.
ReOpenly first freezes the selected examples, so later edits cannot change what the run trains on. Starting the model, preparing your data and publishing the result are not billed: only training time is, and a run that never reaches its first training step costs nothing. Two refusals to expect:
402 insufficient_credits: your balance is zero or does not cover what the run needs to start (step 5).409 training_slot_occupied: an account runs one training job at a time. Creating a job takes no idempotency key, so if a create request times out, list the jobs (GET $P/training-jobs) before you send it again.
To stop a run, POST .../training-jobs/{job_id}/cancel applies before training
begins and POST .../training-jobs/{job_id}/pause after. See
Training jobs for states, controls and billing.
7. Wait until the model is ready
The run is done when GET .../training-jobs/{job_id} reports
"model_available": true. That field, not status, says whether there is a
model to host or download. This loop polls every 30 seconds:
while true; do
job=$(curl -s "$P/training-jobs/<job_id>" -H "Authorization: Bearer $REOPENLY_API_KEY")
case "$job" in
*'"model_available":true'*) echo "model ready"; break ;;
*'"status":"failed"'*|*'"status":"cancelled"'*|*'"status":"paused"'*) echo "$job"; break ;;
esac
sleep 30
done
When it is done, you should see:
{"id": 87, "status": "succeeded", "progress": 100.0, "model_available": true, "cost_credits": 0.0412}
cost_credits is what the run actually charged. How long to expect comes from
the estimate in step 5 (estimated_gpu_minutes for text, estimated_seconds
for embedding): it covers training time only, so the run takes longer from
start to finish, because starting, preparing your data and publishing the
model come before and after it. Without a forecast, follow progress, the
percentage of planned training steps completed.
8. Host the model
Give the trained model a stable name with
POST /api/v1/projects/{owner_slug}/{project_slug}/models. The name you choose
as slug is the model value your code sends. The body is the same for both
project types:
- Text
- Embedding
curl "$P/models" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support bot",
"slug": "support-bot",
"source": {"kind": "training_job", "training_job_id": 87}
}'
You should see:
{"id": 15, "name": "Support bot", "slug": "support-bot", "task": "text_generation", "training_job_id": 87, "active": true}
curl "$P/models" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Citation encoder",
"slug": "citation-encoder",
"source": {"kind": "training_job", "training_job_id": 87}
}'
You should see:
{"id": 16, "name": "Citation encoder", "slug": "citation-encoder", "task": "embedding", "training_job_id": 87, "active": true}
The hosted model takes its task from the job. A top-level "training_job_id"
field still works for older clients, but new code sends source; a request
with both is refused. Later you can point the same name at a newer run without
changing your code: see Hosted models.
9. Call your model
Every project has an OpenAI-compatible base URL. Your hosted model's slug is
the model.
- Text
- Embedding
- Python
- cURL
pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://reopenly.com/api/projects/{owner_slug}/{project_slug}/openai/v1",
api_key="fnf_your_api_key",
timeout=300,
)
response = client.chat.completions.create(
model="support-bot",
messages=[{"role": "user", "content": "How do returns work?"}],
temperature=0.7,
max_tokens=1024,
stream=True,
)
for chunk in response:
print(chunk.choices[0].delta.content or "", end="")
curl "https://reopenly.com/api/projects/{owner_slug}/{project_slug}/openai/v1/chat/completions" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
--max-time 300 \
-d '{"model": "support-bot", "messages": [{"role": "user", "content": "How do returns work?"}]}'
You should see:
{"object": "chat.completion", "model": "support-bot", "choices": [{"index": 0, "message": {"role": "assistant", "content": "Returns are free within 30 days."}}]}
Text models stop when idle, so the first call after a quiet period can take a
few minutes while the model starts: give your client a timeout of at least
5 minutes, as above. If the model is still starting after 4 minutes, the call
answers 503 model_warming with a Retry-After header and is not charged;
wait that long and send it again (the OpenAI SDK retries a 503 on its own).
See OpenAI-compatible API.
- Python
- cURL
pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://reopenly.com/api/projects/{owner_slug}/{project_slug}/openai/v1",
api_key="fnf_your_api_key",
)
response = client.embeddings.create(
model="citation-encoder",
input=["How long is the warranty on the X200?"],
extra_body={"input_type": "query"},
)
print(len(response.data[0].embedding))
curl "https://reopenly.com/api/projects/{owner_slug}/{project_slug}/openai/v1/embeddings" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "citation-encoder", "input": ["How long is the warranty on the X200?"], "input_type": "query"}'
You should see (the vector is trimmed):
{"object": "list", "model": "citation-encoder", "data": [{"object": "embedding", "index": 0, "embedding": [0.0213, -0.0087, 0.0451]}]}
Send input_type: "query" for queries and "document" for passages. To try
the model on a whole dataset first, build a Search index: see
Playground and Search. To keep improving it
from real searches, see Search feedback.
10. Use the weights
The trained weights are yours. Once model_available is true, download them:
curl -L -o model.tar.gz \
"$P/training-jobs/<job_id>/download?format=lora" \
-H "Authorization: Bearer $REOPENLY_API_KEY"
format=lora returns a gzip-compressed archive of the run's LoRA adapter,
not a full model: it holds only the weights training changed, so it runs on top
of the base model it was trained from (the job's model_name). To list the
files and their total size before downloading, call
GET .../training-jobs/{job_id}/download-metadata. Embedding adapters also
include a manifest.json with each file's SHA256 checksum and size. See
Training jobs.
Where to go next
- Core concepts: the terms used across these pages.
- Training jobs: states, settings, evaluation, pause and retry.
- Hosted models: repoint, share or publish a model.
- Errors and retries: which failures to retry, and which never.
- Pricing and billing: rates, statements and adding funds.