Documentation

Forkline's API is OpenAI-compatible. Call any published model with one API key from the same endpoint. The second half covers building and publishing your own model.

Base URLhttps://forkline.ai/v1

Use a model

Quickstart

Three steps to your first call.

  1. Create a key under "API keys" in the console. It is shown only once.
  2. Buy credits under "Billing" (¥500 to ¥100,000 per purchase).
  3. Set the base URL to https://forkline.ai/v1 and call it with an OpenAI SDK or curl.

Authentication

Send the API key as a Bearer token in the Authorization header. Calls are charged to the credits of the person who created the key.

header
Authorization: Bearer fk_...

Chat completions

Call POST /v1/chat/completions. Requests and responses have the same shape as OpenAI's Chat Completions API.

POST/v1/chat/completions

curl https://forkline.ai/v1/chat/completions \
  -H "Authorization: Bearer $FORKLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-model",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Replace your-model with the model ID shown in the store. Model IDs use lowercase letters, digits and hyphens.

Streaming

Set stream: true to receive Server-Sent Events. The last chunk carries usage (token counts), followed by data: [DONE].

python
stream = client.chat.completions.create(
    model="your-model",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="")
stream (end)
data: {"choices":[],"usage":{"prompt_tokens":12,"completion_tokens":48,"total_tokens":60}}

data: [DONE]

: cost_jpy=…

List models

GET /v1/models returns the models published in the store and your own models. id is the model ID.

GET/v1/models

request
curl https://forkline.ai/v1/models \
  -H "Authorization: Bearer $FORKLINE_API_KEY"
response
{
  "object": "list",
  "data": [
    { "id": "your-model", "object": "model", "created": 1793000000, "owned_by": "your-org" }
  ]
}

Pricing and units

You pay the price the model's creator sets. The creator pays for GPU time, so the listed price is all you pay.

  • Input and output tokens are priced in yen per 1M tokens each.
  • Some models also charge a price per request.
  • Before a call, an estimate is held from your credits; after the response it is settled on the actual token counts. If the balance is too low, the call returns 402.
  • The amount charged (JPY) is returned in the X-Forkline-Cost-JPY header for regular responses, and in a final SSE comment line starting with ": cost_jpy=" for streams. SSE clients ignore comment lines.
  • Calling your own models does not charge the price.
response header
X-Forkline-Cost-JPY: 0.0177

Cold starts (503)

A Nebius-hosted model's endpoint stops after 15 minutes without calls. A call to a stopped endpoint starts it and immediately returns 503 model_warming_up with a Retry-After header (30 seconds). Starting can take a few minutes.

response
HTTP/1.1 503 Service Unavailable
Retry-After: 30

{
  "error": {
    "message": "The model is starting up. Retry in about 30 seconds.",
    "type": "model_warming_up",
    "code": "model_warming_up"
  }
}

The OpenAI SDKs retry 503 responses on their own and honour Retry-After. Raise max_retries so the client waits through a cold start.

python
client = OpenAI(
    base_url="https://forkline.ai/v1",
    api_key=os.environ["FORKLINE_API_KEY"],
    max_retries=10,  # 503 + Retry-After
)

Errors

Errors use the same shape as OpenAI's.

response
{
  "error": {
    "message": "Insufficient credits. Top up your balance to continue.",
    "type": "insufficient_credits",
    "code": "insufficient_credits"
  }
}
StatusCodeMeaning
400invalid_requestThe request body is malformed (model and messages are required)
401invalid_api_keyThe API key is missing, malformed or revoked
402insufficient_creditsThe credit balance is too low
403model_suspendedThe model has been suspended by the operator
404model_not_foundThe model does not exist or is not published
409model_not_deployedThe model has not been deployed to an endpoint yet
429rate_limit_exceededRate limit exceeded (600 requests per minute per API key)
502upstream_errorThe model failed to run
503model_warming_upThe endpoint is starting. Wait for Retry-After seconds and retry
503model_unavailableThe model is temporarily unavailable

Publish a model

From dataset to store

In the console, create a model under "Models" with "Fine-tune Nemotron" and follow these steps.

  1. Choose a training dataset (chat-format JSONL). If you only have documents, Nemotron can draft one from them.
  2. Pick a base model and hyperparameters and start training.
  3. When training finishes, deploy the LoRA to an endpoint.
  4. Check responses in the playground. Nemotron evaluates them against the base model's answers.
  5. Set your prices, write a summary and publish to the store.

Dataset format

Write one conversation per line as JSON. role is system, user or assistant, and content is a non-empty string.

train.jsonl
{"messages": [{"role": "system", "content": "You answer questions about our return policy."}, {"role": "user", "content": "How do I return an item?"}, {"role": "assistant", "content": "Send us your order number and …"}]}
{"messages": [{"role": "user", "content": "Who pays for return shipping?"}, {"role": "assistant", "content": "We do, if the item arrived damaged. …"}]}
  • Each line needs at least one user turn and one assistant turn.
  • Use between 10 and 50,000 lines.
  • Files can be up to 10 MB.
  • The format is checked both in the browser and on the server.

Hyperparameters

The defaults work for most datasets.

epochsDefault: 3
How many passes over the dataset (1–10).
learningRateDefault: 0.0002
Learning rate.
loraRankDefault: 64
LoRA rank (4, 8, 16, 32, 64). Higher is more expressive and slower to train.
loraAlphaDefault: 128
Scaling of the LoRA weights. About twice the rank is a good start.

Base models and GPUs

Each base model trains and serves on one GPU of the following type.

Base modelTrainingServing
Nemotron 3 Nano 4BDefaultnvidia/NVIDIA-Nemotron-3-Nano-4B-BF16NVIDIA L40SNVIDIA L40S
Nemotron 3.5 Lightning 30B-A3Bnvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16NVIDIA H200NVIDIA H100

GPU costs and idle stop

GPU time for training and endpoints is deducted from the creator's credits.

  • Training: 1.5× the estimate is held at the start and settled on the actual GPU time at the end. Runs longer than 6 hours are stopped.
  • Endpoints: the boot and idle time is held when an endpoint starts, and running time is billed every minute.
  • An endpoint stops 15 minutes after its last call, and no GPU time is billed after that. The next call starts it again and returns 503 with Retry-After until it is ready.

Prices and payouts

Prices are set in yen, per model.

  • Set prices per 1M input tokens, per 1M output tokens and per request. Set them all to 0 to publish for free.
  • Your earnings are the price users pay minus the platform fee (20%), credited to your earnings.
  • Once Stripe Connect onboarding is complete, you can request payouts from ¥1,000.