Fine-tuning

Fine-tuning allows you to customize a base model with your own training data, improving performance on domain-specific tasks without building a model from scratch.

Supported Base Models

Base ModelFine-tuning Support
deepseek/deepseek-v4-flash
glm-5.1
astra✓ (domain-specific)

How It Works

  1. Prepare data — Upload your training data in JSONL format
  2. Create job — Submit a fine-tuning job with your parameters
  3. Monitor — Track training progress and metrics
  4. Deploy — Your fine-tuned model gets a unique model ID
  5. Use — Call your model via the same API

Training Data Format

{"messages": [{"role": "system", "content": "You are a customer service assistant."}, {"role": "user", "content": "How do I reset my password?"}, {"role": "assistant", "content": "To reset your password, go to Settings > Security > Reset Password."}]}
{"messages": [{"role": "system", "content": "You are a customer service assistant."}, {"role": "user", "content": "What are your business hours?"}, {"role": "assistant", "content": "Our business hours are Monday to Friday, 9 AM to 6 PM."}]}

Creating a Fine-tuning Job

curl https://openapi.linkwo.ai/v1/fine_tuning/jobs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4-flash",
    "training_file": "file-abc123",
    "hyperparameters": {
      "n_epochs": 3,
      "learning_rate_multiplier": 0.1
    },
    "suffix": "my-model"
  }'

Using Your Fine-tuned Model

Once training completes, use the fine-tuned model ID:

response = client.chat.completions.create(
    model="deepseek-v4-flash:ft-my-model:abc123",
    messages=[{"role": "user", "content": "How do I reset my password?"}]
)

Pricing

ItemPrice
Training$1.40 / 1M tokens
Inference (fine-tuned)Base model price × 1.5
Storage$7 / model / month

Best Practices

  • Start with 50-100 high-quality examples
  • Ensure training data is consistent in format and quality
  • Use 3 epochs as a starting point
  • Validate on a held-out test set