Tài liệu tích hợp
Must1c API tương thích cả chuẩn OpenAI và Anthropic. Chọn công cụ của bạn bên dưới — mỗi CLI, IDE và SDK có hướng dẫn riêng, copy-paste là chạy.
Bắt đầu nhanh
1. Lấy API key
Tạo key ở mục API Keys. Dạng mk-live-…
2. Đổi base URL
Trỏ tới endpoint của Must1c thay cho OpenAI/Anthropic.
3. Gọi model
Dùng tên model của Must1c, vd gpt-5.5.
curl https://htmustc.id.vn/v1/chat/completions \
-H "Authorization: Bearer mk-live-xxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [{ "role": "user", "content": "Hello!" }]
}'Endpoints
https://htmustc.id.vn/v1/chat/completions · /completions · /embeddings · /responses · /models
https://htmustc.id.vn/v1/messages (cho Claude Code & Anthropic SDK)
Tạo ảnh
Tương thích endpoint tạo ảnh của OpenAI. Gửi prompt, nhận về ảnh dạng base64 hoặc URL. Dùng tham số n để tạo nhiều ảnh trong một request.
POST /v1/images/generations
Supported media fields: n (1–4), size, quality and aspect_ratio. Available values still depend on the selected upstream model.
curl https://htmustc.id.vn/v1/images/generations \
-H "Authorization: Bearer mk-live-xxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A neon city skyline at dusk",
"n": 1,
"size": "1024x1024",
"quality": "high",
"aspect_ratio": "1:1"
}'Model tạo ảnh tính tiền theo credit MỖI ẢNH, không theo token input/output. Mỗi request bị trừ = số ảnh trả về × giá mỗi ảnh của model (nhân với hệ số gói nếu có). Token do upstream báo về không phản ánh chi phí ảnh nên không dùng để tính tiền.
Chi phí = số ảnh (n) × giá mỗi ảnh
Giá mỗi ảnh do admin đặt riêng cho từng model. Nếu một model tạo ảnh chưa đặt giá mỗi ảnh, nó sẽ quay về cách tính theo token.
Grok image editing
Edit one image or combine up to three source images with Grok Imagine. Source images may be public URLs or image data URLs. Billing uses the selected model price per returned image.
POST /v1/images/edits
curl https://htmustc.id.vn/v1/images/edits -H "Authorization: Bearer mk-live-xxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -d '{
"model": "grok-imagine-image-quality",
"prompt": "Keep the subject unchanged and replace the background with a cinematic neon city",
"image": "https://example.com/source-image.jpg",
"n": 1,
"resolution": "2k",
"aspect_ratio": "16:9"
}'curl https://htmustc.id.vn/v1/images/edits -H "Authorization: Bearer mk-live-xxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -d '{
"model": "grok-imagine-image-quality",
"prompt": "Place the person from the first image into the scene from the second image",
"images": [
"https://example.com/person.jpg",
"https://example.com/background.jpg"
],
"resolution": "2k",
"aspect_ratio": "16:9"
}'Supported Grok image tools
| grok-imagine-image-quality | High-quality generation and editing, recommended for final output |
| grok-imagine-image | Standard generation and editing |
image accepts one source. images accepts 1–3 sources. Do not send both fields in the same request.
Video generation
Generate social-ready videos through the OpenAI-compatible endpoint. Use grok-imagine-video for text-to-video. Models containing 1.5 require an input image.
POST /v1/videos/generations
curl https://htmustc.id.vn/v1/videos/generations -H "Authorization: Bearer mk-live-xxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -d '{
"model": "grok-imagine-video",
"prompt": "A cinematic aerial shot of a futuristic Ho Chi Minh City at night",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "9:16"
}'curl https://htmustc.id.vn/v1/videos/generations -H "Authorization: Bearer mk-live-xxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -d '{
"model": "grok-imagine-video-1.5",
"prompt": "Slow camera push-in, natural wind and cinematic lighting",
"image": "https://example.com/source-image.jpg",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9"
}'| Field | Values | Description |
|---|---|---|
| model | Video model slug | Required |
| prompt | Text | Scene, movement, camera and style |
| aspect_ratio | 1:1, 9:16, 4:5, 16:9 | Social-media frame ratio |
| resolution | 480p, 720p | Requested output quality |
| duration | 1–30 seconds | Provider/model limits still apply |
| image | URL or data URL | Required by grok-imagine-video-1.5 models |
Billing: 1 completed video × model price / video. Video requests can take several minutes while xAI renders and polls the job.
Claude Code
Claude Code
CLIAnthropic-compatible — trỏ ANTHROPIC_BASE_URL là chạy qua proxy
- 1Tạo API key trong mục API Keys.
- 2Đặt 3 biến môi trường bên cạnh (chọn tab theo HĐH).
- 3Chạy `claude` như bình thường — token & chi phí được đo qua gateway.
# macOS / Linux — trỏ Claude Code qua proxy
export ANTHROPIC_BASE_URL="https://htmustc.id.vn"
export ANTHROPIC_AUTH_TOKEN="mk-live-xxxxxxxxxxxxxxxxxxxx"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4.6"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4.8"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4.5"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
claudeCodex CLI
Codex CLI
CLIOpenAI Responses API — khai báo model_provider với wire_api = responses
- 1Tạo API key trong mục API Keys.
- 2Mở ~/.codex/config.toml và thêm provider must1c như bên cạnh.
- 3Đặt biến môi trường MUST1C_API_KEY rồi chạy `codex`.
# ~/.codex/config.toml
model = "gpt-5.5"
model_provider = "must1c"
[model_providers.must1c]
name = "Must1c"
base_url = "https://htmustc.id.vn/v1"
env_key = "MUST1C_API_KEY"
wire_api = "responses"OpenCode
OpenCode
CLIKhai báo Must1c làm provider OpenAI-compatible tùy chỉnh
- 1Mở file cấu hình ~/.config/opencode/opencode.json.
- 2Thêm provider must1c như bên cạnh.
- 3Chọn model trong OpenCode.
// ~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"must1c": {
"npm": "@ai-sdk/openai-compatible",
"name": "Must1c",
"options": {
"baseURL": "https://htmustc.id.vn/v1",
"apiKey": "mk-live-xxxxxxxxxxxxxxxxxxxx"
},
"models": {
"gpt-5.5": { "name": "gpt-5.5" },
"must1c-claude-3-5-sonnet": { "name": "claude-opus-4.8" }
}
}
}
}Cline
Cline
IDE ExtensionVS Code extension — chế độ OpenAI Compatible
- 1Mở Cline → biểu tượng Settings.
- 2Chọn API Provider = OpenAI Compatible.
- 3Điền các trường như bên cạnh rồi lưu.
API Provider: OpenAI Compatible
Base URL: https://htmustc.id.vn/v1
API Key: mk-live-xxxxxxxxxxxxxxxxxxxx
Model ID: gpt-5.5Cursor
Cursor
IDE ExtensionOverride Base URL trong Settings → Models
- 1Vào Settings → Models.
- 2Bật Override OpenAI Base URL và dán base URL.
- 3Thêm model vào danh sách.
Settings → Models → OpenAI API Key
• API Key: mk-live-xxxxxxxxxxxxxxxxxxxx
• Override Base URL: https://htmustc.id.vn/v1
• Thêm model: gpt-5.5Roo Code
Roo Code
IDE ExtensionVS Code — tương tự Cline, chế độ OpenAI Compatible
- 1Mở Roo Code → Settings.
- 2API Provider = OpenAI Compatible.
- 3Điền base URL, key và model.
API Provider: OpenAI Compatible
Base URL: https://htmustc.id.vn/v1
API Key: mk-live-xxxxxxxxxxxxxxxxxxxx
Model: gpt-5.5Continue
Continue
IDE ExtensionVS Code / JetBrains — khai báo trong config.yaml
- 1Mở ~/.continue/config.yaml.
- 2Thêm block models như bên cạnh.
- 3Chọn "Must1c GPT-4o" trong thanh model của Continue.
# ~/.continue/config.yaml
models:
- name: GPT 5.5
provider: openai
model: gpt-5.5
apiBase: https://htmustc.id.vn/v1
apiKey: mk-live-xxxxxxxxxxxxxxxxxxxxOpenAI SDK
OpenAI SDK
SDKPython & Node — chỉ đổi base_url
from openai import OpenAI
client = OpenAI(
api_key="mk-live-xxxxxxxxxxxxxxxxxxxx",
base_url="https://htmustc.id.vn/v1", # đổi từ OpenAI sang Must1c
)
resp = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Xin chào!"}],
)
print(resp.choices[0].message.content)Anthropic SDK
Anthropic SDK
SDKĐặt base_url về gateway, dùng /v1/messages
from anthropic import Anthropic
client = Anthropic(
api_key="mk-live-xxxxxxxxxxxxxxxxxxxx",
base_url="https://htmustc.id.vn", # trỏ về Must1c
)
msg = client.messages.create(
model="claude-opus-4.8",
max_tokens=1024,
messages=[{"role": "user", "content": "Xin chào!"}],
)
print(msg.content[0].text)Mã lỗi
| HTTP | Loại lỗi | Mô tả |
|---|---|---|
| 400 | invalid_request_error | Yêu cầu sai định dạng hoặc thiếu tham số. |
| 401 | authentication_error | API key không hợp lệ hoặc đã bị thu hồi. |
| 403 | permission_error | Key không có quyền truy cập tài nguyên này. |
| 402 | insufficient_quota | Số dư ví không đủ để thực hiện request. |
| 429 | rate_limit_error | Vượt quá giới hạn tần suất (xem header Retry-After). |
| 500 | api_error | Lỗi nội bộ của gateway. |
| 502 | api_error | Lỗi từ nhà cung cấp upstream. |
Cần hỗ trợ? Liên hệ support@must1c.api.