Tài liệu tích hợp

Must1c API tương thích cả chuẩn OpenAI 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.

Claude CodeCodex CLIOpenCodeClineCursorRoo CodeContinueOpenAI SDKAnthropic SDK

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.

Thử ngay với cURL
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

Chuẩn OpenAI
Base URL
https://htmustc.id.vn/v1

/chat/completions · /completions · /embeddings · /responses · /models

Chuẩn Anthropic
Base URL
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.

Tạo ảnh với cURL
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"
  }'
Cách tính tiền

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

Edit one image
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"
  }'
Combine multiple images
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-qualityHigh-quality generation and editing, recommended for final output
grok-imagine-imageStandard 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

Text to video
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"
  }'
Image to video
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"
  }'
Video parameters
FieldValuesDescription
modelVideo model slugRequired
promptTextScene, movement, camera and style
aspect_ratio1:1, 9:16, 4:5, 16:9Social-media frame ratio
resolution480p, 720pRequested output quality
duration1–30 secondsProvider/model limits still apply
imageURL or data URLRequired 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.

CLI

Claude Code

Claude Code

CLI

Anthropic-compatible — trỏ ANTHROPIC_BASE_URL là chạy qua proxy

  1. 1Tạo API key trong mục API Keys.
  2. 2Đặt 3 biến môi trường bên cạnh (chọn tab theo HĐH).
  3. 3Chạy `claude` như bình thường — token & chi phí được đo qua gateway.
macOS / Linux
# 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"

claude
Model phải được map tới pool entry provider Anthropic trong Admin.
CLI

Codex CLI

Codex CLI

CLI

OpenAI Responses API — khai báo model_provider với wire_api = responses

  1. 1Tạo API key trong mục API Keys.
  2. 2Mở ~/.codex/config.toml và thêm provider must1c như bên cạnh.
  3. 3Đặt biến môi trường MUST1C_API_KEY rồi chạy `codex`.
config.toml
# ~/.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"
Model phải map tới pool entry hỗ trợ /v1/responses (OpenAI-compatible) trong Admin.
CLI

OpenCode

OpenCode

CLI

Khai báo Must1c làm provider OpenAI-compatible tùy chỉnh

  1. 1Mở file cấu hình ~/.config/opencode/opencode.json.
  2. 2Thêm provider must1c như bên cạnh.
  3. 3Chọn model trong OpenCode.
opencode.json
// ~/.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" }
      }
    }
  }
}
IDE Extension

Cline

Cline

IDE Extension

VS Code extension — chế độ OpenAI Compatible

  1. 1Mở Cline → biểu tượng Settings.
  2. 2Chọn API Provider = OpenAI Compatible.
  3. 3Điền các trường như bên cạnh rồi lưu.
Cấu hình
API Provider:  OpenAI Compatible
Base URL:      https://htmustc.id.vn/v1
API Key:       mk-live-xxxxxxxxxxxxxxxxxxxx
Model ID:      gpt-5.5
IDE Extension

Cursor

Cursor

IDE Extension

Override Base URL trong Settings → Models

  1. 1Vào Settings → Models.
  2. 2Bật Override OpenAI Base URL và dán base URL.
  3. 3Thêm model vào danh sách.
Cấu hình
Settings → Models → OpenAI API Key
  • API Key:            mk-live-xxxxxxxxxxxxxxxxxxxx
  • Override Base URL:  https://htmustc.id.vn/v1
  • Thêm model:         gpt-5.5
Cursor yêu cầu API key OpenAI hợp lệ về định dạng — key Must1c đáp ứng được.
IDE Extension

Roo Code

Roo Code

IDE Extension

VS Code — tương tự Cline, chế độ OpenAI Compatible

  1. 1Mở Roo Code → Settings.
  2. 2API Provider = OpenAI Compatible.
  3. 3Điền base URL, key và model.
Cấu hình
API Provider:  OpenAI Compatible
Base URL:      https://htmustc.id.vn/v1
API Key:       mk-live-xxxxxxxxxxxxxxxxxxxx
Model:         gpt-5.5
IDE Extension

Continue

Continue

IDE Extension

VS Code / JetBrains — khai báo trong config.yaml

  1. 1Mở ~/.continue/config.yaml.
  2. 2Thêm block models như bên cạnh.
  3. 3Chọn "Must1c GPT-4o" trong thanh model của Continue.
config.yaml
# ~/.continue/config.yaml
models:
  - name: GPT 5.5
    provider: openai
    model: gpt-5.5
    apiBase: https://htmustc.id.vn/v1
    apiKey: mk-live-xxxxxxxxxxxxxxxxxxxx
SDK

OpenAI SDK

OpenAI SDK

SDK

Python & Node — chỉ đổi base_url

Python
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)
SDK

Anthropic SDK

Anthropic SDK

SDK

Đặt base_url về gateway, dùng /v1/messages

Python
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

HTTPLoại lỗiMô tả
400invalid_request_errorYêu cầu sai định dạng hoặc thiếu tham số.
401authentication_errorAPI key không hợp lệ hoặc đã bị thu hồi.
403permission_errorKey không có quyền truy cập tài nguyên này.
402insufficient_quotaSố dư ví không đủ để thực hiện request.
429rate_limit_errorVượt quá giới hạn tần suất (xem header Retry-After).
500api_errorLỗi nội bộ của gateway.
502api_errorLỗi từ nhà cung cấp upstream.

Cần hỗ trợ? Liên hệ support@must1c.api.