How to Train the ChatGPT API on Your Own Data

You cannot train ChatGPT itself, but you can make API calls more accurate by supplying context through the system prompt, retrieving relevant documents at runtime, or using OpenAI's supported fine-tuning for specific tasks. This guide explains when each approach fits.

Updated 4 min read

You cannot change the underlying ChatGPT model by calling the API with your own data. What you can do is shape its behavior for your use case through three supported approaches: instructions in the system prompt, retrieval at runtime, and fine-tuning for specific tasks. Each one fits a different problem.

Most teams start with instructions and retrieval before considering fine-tuning, because those approaches are faster to test and easier to update. Tools like fenbs let you keep the approved project knowledge and the evaluation decisions in one place, independent of which approach you are currently using.

Option 1: Instructions in the system prompt

The system prompt is the first message in every API call. It tells the model who it is, what it knows, and how it should behave. If you have a small amount of domain knowledge — a set of rules, a product definition, a list of terms — you can put it in the system prompt and the model will apply it in every response.

  • Best for: rules, personas, response formats, and compact reference knowledge that fits in a few hundred words.
  • Limits: the system prompt is part of the context window. A very large system prompt costs more per call and leaves less room for the conversation.
  • Update easily: change the system prompt text and the next call uses the new version.

A system prompt is the fastest way to apply your own data to the API. If the knowledge you need fits in a few paragraphs and does not change often, start here. For patterns and examples, see chatgpt prompts for work.

Option 2: Retrieval at runtime (RAG)

Retrieval-augmented generation (RAG) means retrieving relevant documents from a store and including them in the prompt before asking the model to answer. The model reads the retrieved content alongside the user's question and produces an answer grounded in your documents. The documents stay in your own store; only the relevant excerpts are sent to the API.

  • Best for: large knowledge bases, frequently updated information, or cases where you need to cite sources.
  • Requires: a document store, an embedding step to index the documents, and a retrieval step to find the right ones at query time.
  • Update easily: add or remove documents from the store without touching the model.

RAG is the most common approach for making an API application "know" a large body of information. The model itself does not change; the prompt changes on each call to include the retrieved context.

Option 3: Fine-tuning

OpenAI supports fine-tuning for some of its models. Fine-tuning trains a variant of the model on your examples, making it better at tasks with consistent patterns: a specific response style, a particular classification, or a structured output format. Check OpenAI's documentation for which models currently support fine-tuning and the current file format requirements.

  • Best for: tasks where the pattern is consistent and you have many labeled examples (hundreds to thousands).
  • Not ideal for: factual knowledge, frequently changing information, or tasks where you need transparency about the source of an answer.
  • Costs more to set up: you need training data, a fine-tuning job, and evaluation before deploying.

Fine-tuning adjusts the model's behavior, not its knowledge cutoff. It will not "know" facts you put in training examples; it will produce outputs in the style or format those examples demonstrate.

How fenbs helps

Keep the approved project knowledge separate from the model

Add the project to fenbs. Write the domain knowledge, the approved definitions, and the evaluation criteria as AI context notes and tasks. When you switch between approaches — from system prompt to retrieval to fine-tuning — the knowledge record stays current and available to every developer working on the project.

Create a free account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

How to choose between the three approaches

Choosing between instructions, retrieval, and fine-tuning
ApproachUse whenNot ideal when
System prompt instructionsKnowledge is compact and stable; you need a fast start.Knowledge is large or changes often; cost per call matters.
Retrieval (RAG)Knowledge is large, updated often, or needs to be cited.Retrieval infrastructure is too heavy for a simple use case.
Fine-tuningYou have hundreds of consistent, labeled examples of the task.You need factual accuracy, transparency, or fast iteration.

How to evaluate results

Whichever approach you use, evaluation is how you know whether it is working. A vague sense that responses "seem better" is not enough. Define what a good response looks like before you start, and test against that definition.

  1. Write a set of test questions and their expected answers before building.
  2. Run the questions through the API and compare the responses to the expected answers.
  3. Score each response on the dimensions that matter: accuracy, format, tone, completeness.
  4. Record which test cases pass and which fail after each change.
  5. When the approach changes, rerun the same test set to confirm improvement.

See the claude vs chatgpt and chatgpt alternatives guides if you are also evaluating which API to use for your project.

How to do this with fenbs

  1. Create a free account and add a project for the API application.
  2. Write the project knowledge — definitions, rules, evaluation criteria — as AI context notes and tasks.
  3. Record the approach decision in Decisions and rules: which method you chose, why, and what the evaluation showed.
  4. When a test case fails or the approach changes, update the task plan and record the lesson.
  5. Connect your coding assistant to fenbs from Integrations so it reads the current knowledge and decisions before each development session.

Questions people ask.

Can I make ChatGPT learn from my data permanently?

No. API calls do not change the underlying model. You can supply your data in the system prompt or through retrieval on each call, or you can fine-tune a model variant on your examples. None of these change the base ChatGPT model.

What is the fastest way to get the API to use my company's knowledge?

Put a compact summary of the knowledge in the system prompt. It takes minutes and produces results immediately. If the knowledge is too large or changes too often for a system prompt, move to retrieval.

How many examples do I need for fine-tuning?

OpenAI's documentation gives the current guidance on minimum example counts and file formats, as these requirements change with new model releases. Check the fine-tuning documentation on OpenAI's site for current requirements.

Will fine-tuning make the API more accurate on facts?

Not reliably. Fine-tuning is better at teaching style, format, and consistent patterns than at implanting factual knowledge. For factual accuracy, retrieval is a better fit because the model cites the source document in the prompt.

How do I know which approach is working?

Write a test set of questions and expected answers before you start. Run the test set after each change. Score responses on the dimensions that matter for your use case. Gut feel is not a reliable guide; repeatable test results are.

More in Agent harness (for developers)

All Agent harness (for developers) articles

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.