Skip to main content

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.

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)

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.

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"}
}

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​

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.

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.

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.

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.

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.

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:

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}

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.

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="")

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.

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​