# My university gave me an AI API: why I read the terms before wiring it into my site

> My university's computing center offers an OpenAI-compatible campus API. I meant to connect it to this site, but the terms said otherwise. Testing also exposed a curl JSON trap and a .gitignore that missed .env.

- Date: 2026-11-28
- Topics: AI, Security
- Chinese original: https://kbs0830.com/blog/school-ai-api-terms

My university's computing center launched a service called "iAI". You log in with your campus account to get an API key, and behind it are the school's own GPUs, with models such as the Furen series, embeddings and speech recognition. My first thought was: this site already has an AI chat, so why not plug this in?

Before doing anything, I read the terms of service that appear after login. The conclusion: **it cannot be connected to this site**.

## The three things in the terms that concern me

| Point in the terms | What it means for this site |
|---|---|
| Only for classroom teaching, coursework and projects, academic research and school testing; commercial use is banned | A personal portfolio is none of those |
| The API must not be resold or distributed to third parties | The site is public, so visitors would be indirectly using this API |
| The API key must not be shared with people outside the school | Even with the key on the server side, anyone could call it through my site |

The consequence of a violation is not a warning: the terms say access can be permanently revoked without notice, the compute cost consumed can be recovered, and serious cases are referred to the school for handling. And when a key is abused, the account holder is responsible.

So the AI chat on this site keeps using Ollama on my own desktop. iAI is used only in coursework. On the site, all I wrote in About is "starting to use it in school projects", and **not a single request from the pages themselves goes to it**.

## Testing: look at `/models` first, then try a chat

It uses the OpenAI-compatible format, so I first confirmed the key worked with the cheapest request:

```bash
curl -s -H "Authorization: Bearer $IAI_API_KEY" "$IAI_BASE_URL/models"
```

It returned 200 and listed twelve models. Then I called `/chat/completions`, and the first attempt got a 400:

```
Invalid model name passed in model=None
```

I had clearly included `"model": "Furen-std"`. The reason is that in Git Bash I stuffed JSON containing Chinese directly into `curl -d`, the body was not parsed correctly, and the server saw it as empty. Writing it to a file first and sending it with `--data-binary @file` returned 200:

```bash
curl -s -H "Authorization: Bearer $IAI_API_KEY" -H "Content-Type: application/json" \
  --data-binary @body.json "$IAI_BASE_URL/chat/completions"
```

This trap only shows up in command-line testing. With Python's `openai` SDK you will not meet it, since the SDK serializes the JSON itself.

## A more important thing: .gitignore did not block .env

The key goes into `.env`, and the coursework repo is a private repo on GitHub. I checked its `.gitignore`, which had only these lines:

```
venv/
.venv/
env/
```

`env/` blocks a **folder**, not a file named `.env`. If I had just created `.env` and run `git add .`, the key would have gone into git history, the kind you cannot wash out: even if you delete the file later, the old commit still shows it.

I added the rules first, then created the file, then confirmed it was really blocked with `git check-ignore -v .env`:

```
.env
.env.*
!.env.example
*.key
credentials.json
```

I also put a `.env.example` with only the variable names into git, so that when I switch computers I know what to fill in.

## What I do now

1. **When you get a key to any service, read its terms of use first**, especially the "restrictions on use" and "may it be given to third parties" clauses.
2. **Before creating `.env`, check `.gitignore`**, and verify with `git check-ignore` rather than by eye.
3. **Do not paste keys into conversations or print them to logs.** While testing I only confirmed "it is filled in and the length is not 0", and never printed the value.
4. Keep campus resources for campus purposes: coursework runs locally, and for a demo to put in a portfolio, use a screenshot or a recording.

---

Author: PINGWEI LI (李秉威, Li Ping-Wei)
Original page: https://kbs0830.com/en/blog/school-ai-api-terms
