Courses3 levels
Level 1 · Foundations11 courses
Level 2 · Core5 courses
Level 3 · Advanced5 courses
Labs8 topics
Library Practice exams AI Range Pricing Start free

Lesson 08 · 40 minutes

Check a third-party model provider before you depend on it

After this lesson you can
  • Say what the model provider, the platform and you each own
  • Name the duties that you cannot hand to a provider
  • Score a provider with a checklist and decide to accept, accept with conditions, hold or reject
Lab files of this lesson (32)

The lab folder as it stands after this lesson. Unzip it in ~/krlab.

More

The zip holds every file that the course has printed up to here. To start this lesson with the files of the earlier lessons only, take the zip of the lesson before. Type the code yourself first: you learn more.

Scenario

The KR Books team chose a hosted model on Friday and plans to send the first customer prompts on Monday. In the contract is a sentence that the provider may use "inputs to improve its services". Nobody has read it. Your manager asks you for a written check before the first prompt, with a clear answer: use the provider, use it with conditions, wait, or refuse. Then she gives you a second provider to check the same way.

Recall

Lesson 1: to which trust group does the model provider belong, and how did assets.py mark the model?

To the third-party group. The script marked the model asset A2 with ASK, because a writer that you do not control can change it.

Lesson 7: which kind of control is a review of the provider before the contract?

Govern. It decides, assigns and reviews. It does not stop an attack by itself, so it works together with prevent, detect and respond controls.

The idea

A hosted model is a service, and security is shared between you and the provider. The line between the two moves with the way you use the model.

Who owns what, from your code down
Youdata, prompt, tools, output, monitoringPlatformits features; you set identity, logs, indexProviderweights, servers, its own patchingYoudata, prompt, tools, output, monitoringPlatformits features; you set identity, logs, indexProviderweights, servers, its own patching
You useThe provider or platform ownsYou own
A model API (a company hosts the model and you call it)The weights, the training, the servers, the patching of its own stackThe data that you send, the prompt, the retrieval, the tools and their rights, your API sign-in, the handling of the output, monitoring
A managed AI platform (hosting, a vector store, agent features)The infrastructure and the features that it sellsEverything above, and the settings of the platform: identity, network access, logging, who can read your index
An open model that you runNothing at run timeEverything: the origin and hash of the model file, the runtime, the server, updates, support

You can move work to a provider, but not the accountability for what happens to your customers. Six duties stay with you in every row.

  • Decide what data leaves. You choose what goes into a prompt, so you decide what the provider can see.
  • Control access to your own data and tools. The provider cannot know which customer may see which order.
  • Treat the output as untrusted. The provider cannot know what your page or your database does with it.
  • Monitor your own use. A provider's log is not your audit trail, and it may not exist.
  • Respond to your incidents. Your customers will call you, not the provider.
  • Prepare to leave. The model can change, rise in price or go away.

The NIST AI Risk Management Framework asks organisations to Govern, Map, Measure and Manage AI risk. A provider check belongs to Map (who else is involved?) and Govern (who decides whether we depend on them?).

A due-diligence checklist is a set of questions that you ask before you depend on a supplier. Each question has a weight and an answer: yes, partial, no or unknown. Some questions are critical: an answer that is not yes stops the decision until the provider fixes it, or until a named person accepts the risk in writing. A claim without evidence is only a claim, so each answer carries a note on where it came from.

Worked example

1. Write the checklist for a provider

You review "Larkspur Models", a fictional provider of a hosted chat model. Make the folder.

mkdir -p ~/krlab/ai-security-fundamentals/vendor
cd ~/krlab/ai-security-fundamentals/vendor

Create vendor.json. This is the first state: the provider has not yet answered the training question (V1).

vendor/vendor.json

{
  "provider": "Larkspur Models (a fictional provider)",
  "service": "hosted chat model API",
  "items": [
    {"id": "V1", "weight": 3, "critical": true, "answer": "unknown", "evidence": "",
     "question": "Are your prompts and outputs kept out of model training?"},
    {"id": "V2", "weight": 2, "critical": false, "answer": "partial", "evidence": "Terms: logs kept 'for a limited time'",
     "question": "Is the retention period written, and 30 days or less?"},
    {"id": "V3", "weight": 2, "critical": false, "answer": "yes", "evidence": "Trust page lists two regions",
     "question": "Are the processing regions named, and are they acceptable to you?"},
    {"id": "V4", "weight": 1, "critical": false, "answer": "yes", "evidence": "Public subprocessor list, 30 days notice",
     "question": "Is the list of subprocessors public, with notice of changes?"},
    {"id": "V5", "weight": 2, "critical": false, "answer": "yes", "evidence": "SOC 2 Type II report, read 2026-10",
     "question": "Does the provider hold an independent audit report that you have read?"},
    {"id": "V6", "weight": 2, "critical": false, "answer": "partial", "evidence": "Versions can be pinned; retirement notice is 60 days",
     "question": "Can you pin a model version, with 90 days notice before it retires?"},
    {"id": "V7", "weight": 3, "critical": true, "answer": "no", "evidence": "Terms say 'without undue delay', no hours",
     "question": "Does the contract require notice of a security incident within 48 hours, or a time that lets you meet your own legal deadline?"},
    {"id": "V8", "weight": 1, "critical": false, "answer": "yes", "evidence": "security.txt and a disclosure page",
     "question": "Is there a security contact and a public disclosure route?"},
    {"id": "V9", "weight": 2, "critical": false, "answer": "yes", "evidence": "Per-key spend and rate limits in the console",
     "question": "Do you control spend limits and rate limits for each key?"},
    {"id": "V10", "weight": 2, "critical": false, "answer": "partial", "evidence": "Usage totals only, no per-request log",
     "question": "Can you read a log of your own calls?"},
    {"id": "V11", "weight": 1, "critical": false, "answer": "yes", "evidence": "Delete API and export on request",
     "question": "Can you export and delete your data, and leave without lock-in?"},
    {"id": "V12", "weight": 1, "critical": false, "answer": "no", "evidence": "No model card or test results published",
     "question": "Does the provider publish what it tests, such as a model card or red-team results?"}
  ]
}
One item of vendor.json (V7)
"id": "V7"the question"weight": 3points of 22 that it counts"critical": truea no stops the decision"answer": "no"yes, partial, no or unknown"evidence": "Terms say..."where the answer came from"id": "V7"the question"weight": 3points of 22 that it counts"critical": truea no stops the decision"answer": "no"yes, partial, no or unknown"evidence": "Terms say..."where the answer came from

The weights add up to 22. The two critical questions are the training question and the breach notice.

2. Write the scoring script

Create score.py. A yes earns the full weight, a partial earns half, and a no or an unknown earns nothing. A critical item that is not a yes makes the verdict HOLD, unless the item has an accepted_by field: the name of a person with the authority to accept that risk. The script needs only the name. Otherwise 80 percent or more is ACCEPT, 60 to 79 is ACCEPT WITH CONDITIONS, and less is REJECT. The script also lists the accepted critical items, the partial answers (each needs a fix or a written condition) and the yes answers that have no evidence. POINTS is a dictionary that turns an answer into a number, item.get("accepted_by") gives the field, or nothing when the item has no such field (item["accepted_by"] would stop with an error), and {earned:g} prints a number without a .0.

vendor/score.py

import json
import sys

POINTS = {"yes": 1.0, "partial": 0.5, "no": 0.0, "unknown": 0.0}

with open(sys.argv[1] if len(sys.argv) > 1 else "vendor.json") as f:
    review = json.load(f)

earned = total = 0
blockers, accepted, conditions, unproven = [], [], [], []
for item in review["items"]:
    answer = item["answer"]
    total += item["weight"]
    earned += item["weight"] * POINTS[answer]
    if item["critical"] and answer != "yes":
        if item.get("accepted_by"):
            accepted.append(item["id"])
        else:
            blockers.append(item["id"])
    if answer == "partial":
        conditions.append(item["id"])
    if answer == "yes" and not item["evidence"]:
        unproven.append(item["id"])

percent = round(100 * earned / total)
if blockers:
    verdict = "HOLD"
elif percent >= 80:
    verdict = "ACCEPT"
elif percent >= 60:
    verdict = "ACCEPT WITH CONDITIONS"
else:
    verdict = "REJECT"

print(review["provider"])
print(f"score: {earned:g} of {total} points ({percent} percent)")
print("critical items that are not yes and not accepted:", blockers or "none")
print("critical items accepted by a named person:", accepted or "none")
print("partial answers (ask for a fix or a written condition):", conditions or "none")
print("yes answers with no evidence:", unproven or "none")
print("verdict:", verdict)

3. Run it on the first state

python3 score.py
Larkspur Models (a fictional provider)
score: 12 of 22 points (55 percent)
critical items that are not yes and not accepted: ['V1', 'V7']
critical items accepted by a named person: none
partial answers (ask for a fix or a written condition): ['V2', 'V6', 'V10']
yes answers with no evidence: none
verdict: HOLD

4. Record the provider's answer to V1

You write to the provider. The provider replies that prompts are not used for training, with a clause and a setting in the console. Record the answer and the evidence, then run the script again. The sed command replaces the first state of V1 with the new one and writes a new file, and mv puts that file in place of the old one (sed -i differs between Linux and macOS). tail -6 shows the last six lines.

sed 's/"answer": "unknown", "evidence": ""/"answer": "yes", "evidence": "Terms 4.2 and a console switch, shown in a screenshot"/' vendor.json > vendor.new
mv vendor.new vendor.json
python3 score.py | tail -6
score: 15 of 22 points (68 percent)
critical items that are not yes and not accepted: ['V7']
critical items accepted by a named person: none
partial answers (ask for a fix or a written condition): ['V2', 'V6', 'V10']
yes answers with no evidence: none
verdict: HOLD

The score went up and the verdict did not change. One critical item is still a no.

5. Record the answer to V7 and read the verdict

The provider will not change the contract. It gives a written promise of notice within 96 hours, in a letter. That does not meet your need of 48 hours, so the honest answer stays no, and the letter is only evidence. The head of product reads the risk and accepts it in writing. Edit the V7 line of vendor.json by hand so that it reads as follows, and run the script a last time.

    {"id": "V7", "weight": 3, "critical": true, "answer": "no", "evidence": "Letter: notice within 96 hours, not in the contract",
     "accepted_by": "head of product, 2026-11-20",
     "question": "Does the contract require notice of a security incident within 48 hours, or a time that lets you meet your own legal deadline?"},
python3 score.py | tail -6
score: 15 of 22 points (68 percent)
critical items that are not yes and not accepted: none
critical items accepted by a named person: ['V7']
partial answers (ask for a fix or a written condition): ['V2', 'V6', 'V10']
yes answers with no evidence: none
verdict: ACCEPT WITH CONDITIONS

The verdict is not "safe". A no still earns nothing, so the score did not move: a named person now owns the risk. You carry four conditions: ask for a written retention period (V2), plan for a 60-day retirement notice (V6), log your own calls on your side (V10), and get the breach notice into the contract at renewal (V7). Do not change a no to a partial to move the verdict: that hides the risk.

6. The finished file

This is the whole vendor.json after steps 4 and 5. The lab files of the course hold it.

The finished file: vendor.json

vendor/vendor.json

{
  "provider": "Larkspur Models (a fictional provider)",
  "service": "hosted chat model API",
  "items": [
    {"id": "V1", "weight": 3, "critical": true, "answer": "yes", "evidence": "Terms 4.2 and a console switch, shown in a screenshot",
     "question": "Are your prompts and outputs kept out of model training?"},
    {"id": "V2", "weight": 2, "critical": false, "answer": "partial", "evidence": "Terms: logs kept 'for a limited time'",
     "question": "Is the retention period written, and 30 days or less?"},
    {"id": "V3", "weight": 2, "critical": false, "answer": "yes", "evidence": "Trust page lists two regions",
     "question": "Are the processing regions named, and are they acceptable to you?"},
    {"id": "V4", "weight": 1, "critical": false, "answer": "yes", "evidence": "Public subprocessor list, 30 days notice",
     "question": "Is the list of subprocessors public, with notice of changes?"},
    {"id": "V5", "weight": 2, "critical": false, "answer": "yes", "evidence": "SOC 2 Type II report, read 2026-10",
     "question": "Does the provider hold an independent audit report that you have read?"},
    {"id": "V6", "weight": 2, "critical": false, "answer": "partial", "evidence": "Versions can be pinned; retirement notice is 60 days",
     "question": "Can you pin a model version, with 90 days notice before it retires?"},
    {"id": "V7", "weight": 3, "critical": true, "answer": "no", "evidence": "Letter: notice within 96 hours, not in the contract",
     "accepted_by": "head of product, 2026-11-20",
     "question": "Does the contract require notice of a security incident within 48 hours, or a time that lets you meet your own legal deadline?"},
    {"id": "V8", "weight": 1, "critical": false, "answer": "yes", "evidence": "security.txt and a disclosure page",
     "question": "Is there a security contact and a public disclosure route?"},
    {"id": "V9", "weight": 2, "critical": false, "answer": "yes", "evidence": "Per-key spend and rate limits in the console",
     "question": "Do you control spend limits and rate limits for each key?"},
    {"id": "V10", "weight": 2, "critical": false, "answer": "partial", "evidence": "Usage totals only, no per-request log",
     "question": "Can you read a log of your own calls?"},
    {"id": "V11", "weight": 1, "critical": false, "answer": "yes", "evidence": "Delete API and export on request",
     "question": "Can you export and delete your data, and leave without lock-in?"},
    {"id": "V12", "weight": 1, "critical": false, "answer": "no", "evidence": "No model card or test results published",
     "question": "Does the provider publish what it tests, such as a model card or red-team results?"}
  ]
}

Your turn

The manager gives you a second provider, "Heronfield AI". Save its first state as heronfield.json in the same folder.

vendor/heronfield.json

{"provider": "Heronfield AI (a fictional provider)", "service": "hosted chat model API", "items": [
 {"id": "V1", "weight": 3, "critical": true, "answer": "yes", "evidence": "Terms 5.1 and a console switch", "question": "Are prompts and outputs kept out of training?"},
 {"id": "V2", "weight": 2, "critical": false, "answer": "yes", "evidence": "30 days, written in the terms", "question": "Is retention written, and 30 days or less?"},
 {"id": "V3", "weight": 2, "critical": false, "answer": "no", "evidence": "No region is named", "question": "Are the processing regions named?"},
 {"id": "V4", "weight": 1, "critical": false, "answer": "partial", "evidence": "List is public, no notice of changes", "question": "Is the subprocessor list public, with notice?"},
 {"id": "V5", "weight": 2, "critical": false, "answer": "unknown", "evidence": "", "question": "Have you read an independent audit report?"},
 {"id": "V6", "weight": 2, "critical": false, "answer": "yes", "evidence": "Pin for 12 months", "question": "Can you pin a model version?"},
 {"id": "V7", "weight": 3, "critical": true, "answer": "no", "evidence": "Terms say 'a reasonable time'", "question": "Is breach notice within 48 hours in the contract?"},
 {"id": "V8", "weight": 1, "critical": false, "answer": "yes", "evidence": "", "question": "Is there a security contact?"}
]}

Score it. Then the provider replies to your three open questions. For V7, it signs an amendment that puts notice within 48 hours into the contract. For V5, it sends its SOC 2 Type II report, and you read it. For V3, it names two regions, but you cannot choose between them: record V3 as partial. Leave V4 and V8 as they are. Record each reply with a short evidence note, and score again.

Last, write the verdict and the conditions that you still carry, in two lines.

Check yourself

The provider hosts the model and holds its weights. Why is a prompt injection against your chatbot still your problem?

The injection works through your prompt, your retrieval and your tools. The provider cannot know which text in your prompt is hostile or what your tool may do.

Why does the script stop at HOLD even when the score is high?

A weighted score can hide a fatal gap: a provider that trains on your data and answers everything else well still scores well. Critical items are a veto.

What is the value of the "evidence" field?

It separates a claim from a fact. A reader can check the clause, the report or the screenshot. The script lists a yes without evidence so that you ask for it.

You run an open model on your own server. Which rows of the table now belong to you?

All of them. No provider stands behind the system.

Field notes

  • Put the answers into the contract, not only into a web page. A trust page can change without notice, and a clause cannot. Typical clauses: no training on your data, a written retention period, breach notice in hours (some laws give you 72 hours to report), a list of subprocessors, a right to an audit report, and notice before a model is retired.
  • Ask for dated evidence: an audit report such as SOC 2 or an ISO/IEC 27001 certificate, and its scope. Check that the scope covers the service that you use.
  • Review again at each renewal and when the provider announces a new model, region or subprocessor. A model change is a change of your system, so run your fixed test set (lesson 7) before you move.
  • Keep a way out: a second provider or a local model for the critical function, and a tested export of your data.
  • Treat the provider as an untrusted writer of asset A2 in your map (lesson 1). Its answers are output that must be checked.