Kết nối OpenAI-compatible với GreenNode MaaS
Last updated
curl https://maas-llm-aiplatform-hcm.api.vngcloud.vn/v1/models \
-H "Authorization: Bearer <your-api-key>"from openai import OpenAI
client = OpenAI(
base_url="https://maas-llm-aiplatform-hcm.api.vngcloud.vn/v1",
api_key="<your-api-key>",
)
response = client.chat.completions.create(
model="openai/gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://maas-llm-aiplatform-hcm.api.vngcloud.vn/v1",
apiKey: "<your-api-key>",
});
const response = await client.chat.completions.create({
model: "openai/gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0].message.content);export OPENAI_BASE_URL="https://maas-llm-aiplatform-hcm.api.vngcloud.vn/v1"
export OPENAI_API_KEY="<your-api-key>"import litellm
response = litellm.completion(
model="openai/gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
base_url="https://maas-llm-aiplatform-hcm.api.vngcloud.vn/v1",
api_key="<your-api-key>",
)
print(response.choices[0].message.content)curl https://maas-llm-aiplatform-hcm.api.vngcloud.vn/v1/chat/completions \
-H "Authorization: Bearer <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"messages": [{"role": "user", "content": "ping"}]
}'