Welcome to CPE AI Gateway, an AI service provided by the Department of Computer Engineering (CPE), KMUTT.
CPE AI Gateway provides access to department-hosted Large Language Models (LLMs) and Embedding Models through an OpenAI-compatible API. It can be used for coursework, senior projects, research,software development, and other approved academic purposes.
API Gateway: https://gateway.ai.cpe.kmutt.ac.th
| Model | Type | Recommended Use |
|---|---|---|
muse-glimmer-30b |
Multimodal Large Language Model | Advanced reasoning, programming, agentic tasks, image understanding, and complex problem solving |
qwen3.8-27b |
Large Language Model | General-purpose chat, text generation, summarization, and question answering |
bge-m3 |
Embedding Model | Embeddings, semantic search, document retrieval, and RAG |
The bge-m3 embedding service returns 1024-dimensional vectors.
Note: Available models may change over time, and access may depend
on your API key. Use/v1/modelsto check the models currently
available to you.
An API key is required to use CPE AI Gateway.
Register for access using:
CPE AI Gateway --- API Access Registration
https://forms.gle/uPab3hka9sDKfjQQ8
Complete the requested information about yourself, your project or topic, intended usage, and expected usage period.
Senior Project Students: In the Topic field, include your
Senior Project Group ID at the beginning using the format[G00].Example:
[G12] AI-based Network Monitoring
After submitting the form, wait for the request to be reviewed. Once approved, an API Key will be sent to the email address provided during registration.
Your API key authenticates requests and identifies your usage.
It looks similar to:
sk-xxxxxxxxxxxxxxxxxxxxxxxx
Treat it like a password. Do not share it, commit it to GitHub, place it in public source code, or expose it in reports, screenshots, notebooks, websites, or documentation.
If you believe your key has been exposed, contact CPE IT so it can be revoked and replaced.
Use the following OpenAI-compatible Base URL:
https://gateway.ai.cpe.kmutt.ac.th/v1
Authentication uses an HTTP Bearer token:
Authorization: Bearer YOUR_API_KEY
Applications and libraries that support an OpenAI-compatible API and a custom Base URL can generally be configured to use CPE AI Gateway.
The recommended first test is:
curl https://gateway.ai.cpe.kmutt.ac.th/v1/models -H "Authorization: Bearer YOUR_API_KEY"
curl https://gateway.ai.cpe.kmutt.ac.th/v1/models -H "Authorization: Bearer YOUR_API_KEY"
A successful response confirms that the gateway is reachable, the key is valid, and shows the models available to your account.
Example:
curl https://gateway.ai.cpe.kmutt.ac.th/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.8-27b",
"messages": [
{
"role": "user",
"content": "Explain cloud computing in simple terms."
}
]
}'
Tip: Check
/v1/modelsbefore selecting a model because model
names and availability may change.
Install the OpenAI Python SDK:
pip install openai
Example:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://gateway.ai.cpe.kmutt.ac.th/v1"
)
response = client.chat.completions.create(
model="qwen3.8-27b",
messages=[
{
"role": "user",
"content": "Hello! What can you do?"
}
]
)
print(response.choices[0].message.content)
For actual projects, do not hard-code the API key in your source code. Use an environment variable instead.
export CPE_AI_API_KEY="sk-xxxxxxxxxxxxxxxx"
$env:CPE_AI_API_KEY="sk-xxxxxxxxxxxxxxxx"
Python example:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["CPE_AI_API_KEY"],
base_url="https://gateway.ai.cpe.kmutt.ac.th/v1"
)
response = client.chat.completions.create(
model="qwen3.8-27b",
messages=[
{"role": "user", "content": "Explain what a GPU is."}
]
)
print(response.choices[0].message.content)
Recommended: Never commit API keys to Git repositories. If you use
a.envfile or another local secrets file, exclude it using
.gitignore.
The bge-m3 model can be used for semantic search, document retrieval, text similarity, Retrieval-Augmented Generation (RAG), and knowledge-base search.
Example:
curl https://gateway.ai.cpe.kmutt.ac.th/v1/embeddings \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bge-m3",
"input": "Department of Computer Engineering, KMUTT"
}'
The service returns a 1024-dimensional embedding vector.
Python example:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["CPE_AI_API_KEY"],
base_url="https://gateway.ai.cpe.kmutt.ac.th/v1"
)
response = client.embeddings.create(
model="bge-m3",
input="Department of Computer Engineering, KMUTT"
)
vector = response.data[0].embedding
print("Embedding dimensions:", len(vector))
CPE AI Gateway is a shared departmental computing service.
CPE IT may apply usage limits, token limits, rate limits, budgets, or other resource controls to maintain fair access to the shared infrastructure.
Check that the request contains:
Authorization: Bearer YOUR_API_KEY
Verify that the API key is correct and has not been revoked.
Check the current model list:
curl https://gateway.ai.cpe.kmutt.ac.th/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
Use the exact model ID returned by the API.
Verify the endpoint:
https://gateway.ai.cpe.kmutt.ac.th/v1
Also check your Internet connection and DNS resolution.
Your API key may have reached a configured usage, token, budget, or rate limit. Reduce unnecessary requests and retry later. Contact CPE IT if additional resources are required for your project.
openai PackageInstall it with:
pip install openai
Make sure the package is installed in the same Python, virtual environment, or Conda environment used to run your program.
https://forms.gle/uPab3hka9sDKfjQQ8.GET /v1/models./v1/chat/completions.https://gateway.ai.cpe.kmutt.ac.th/v1Your application can now use CPE AI Gateway.
When requesting support, provide your name or project/group information, model, API endpoint, approximate time of the problem, HTTP status code, and error message.
Do not include your API key in support messages, screenshots, or
shared logs.
CPE AI Gateway
Department of Computer Engineering
Faculty of Engineering
King Mongkut's University of Technology Thonburi