이 페이지
임베딩
기본 경로: /v1
POST /embeddings
텍스트, 토큰 ID 또는 채팅 메시지에 대한 임베딩을 생성합니다. input 또는 messages 중 정확히 하나를 보내세요. 요청당 최대 20개의 입력 또는 대화가 허용됩니다. messages의 이미지는 base64 데이터 URI여야 하며, 총 이미지 페이로드는 최대 20MB입니다.
| 매개변수 | 유형 | 필수 | 설명 |
|---|---|---|---|
| Core Input | |||
| model | string | required | Embedding model identifier. Use GET /v1/embedding-models to list models available to your account. |
| input | string | list[string] | list[int] | list[list[int]] | list[chat messages] | required (or messages) | Text, token IDs, a list of texts, or chat messages to embed. Exactly one of input or messages must be provided. Lists are capped at 20 items per request. |
| messages | list[message] | list[list[message]] | required (or input) | One chat conversation or a batch of conversations to embed. Exactly one of input or messages must be provided. Batches are capped at 20 conversations. Use content parts for multimodal input; image URLs must be base64 data URIs (data:image/...) and the total image payload is limited to 20MB. |
| Encoding | |||
| encoding_format | "float" | "base64" | optional | Embedding encoding. "float" returns a JSON number array; "base64" returns base64-encoded binary and is more compact. Default: "float". |
| dimensions | integer | optional | Requested embedding size. Must be a positive integer when set. Model support and truncation behavior are model-dependent. |
| embed_dtype | "float32" | "float16" | "bfloat16" | "fp8_e4m3" | "fp8_e5m2" | optional | Numeric dtype used when encoding_format is "base64". Default: "float32". |
| endianness | "native" | "big" | "little" | optional | Byte order used when encoding_format is "base64". Default: "native". |
| use_activation | boolean | null | optional | Whether to apply the pooler's activation to the output. null uses the model's default, which is usually true. |
| Truncation & Tokenization | |||
| truncate_prompt_tokens | integer | optional | Truncate each input to this many tokens. Use -1 to keep all tokens, or a positive integer to keep only that many. |
| truncation_side | "left" | "right" | optional | Side to keep when truncating. "right" keeps the first N tokens; "left" keeps the last N tokens. |
| padding | "max_length" | "do_not_pad" | optional | Tokenizer padding mode. "max_length" is required by some fixed-length embedding models such as SigLIP to produce comparable embeddings. |
| add_special_tokens | boolean | optional | Whether to add model special tokens (for example BOS) to the input. Defaults to true for text input and false for chat messages. |
1curl -X POST https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5 "model": "EMBEDDING_MODEL_NAME",
6 "input": [
7 "The food was delicious.",
8 "The service was slow."
9 ],
10 "encoding_format": "float"
11}'응답 예제
1{
2 "id": "embd-2c0a5f6e-4f1b-4a5e-9f2f-3c7f9d1a6b8e",
3 "object": "list",
4 "created": 1760000000,
5 "model": "EMBEDDING_MODEL_NAME",
6 "data": [
7 {
8 "index": 0,
9 "object": "embedding",
10 "embedding": [0.0123, -0.0456, 0.0789]
11 },
12 {
13 "index": 1,
14 "object": "embedding",
15 "embedding": [-0.0321, 0.0678, 0.0912]
16 }
17 ],
18 "usage": {
19 "prompt_tokens": 12,
20 "total_tokens": 12
21 }
22}The embedding array above is shortened for display. For compact responses, use encoding_format: "base64". Binary responses use embed_dtype and endianness to describe how to decode them.
1curl -X POST https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5 "model": "EMBEDDING_MODEL_NAME",
6 "input": ["A compact base64 embedding"],
7 "encoding_format": "base64",
8 "embed_dtype": "float32",
9 "endianness": "native"
10}'POST /embeddings (멀티모달)
콘텐츠 파트와 함께 messages를 사용하여 이미지와 텍스트를 함께 임베딩합니다. 각 image_url.url은 data:image/jpeg;base64,...와 같은 base64 데이터 URI여야 하며, 원격 이미지 URL은 거부됩니다.
1curl -X POST https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5 "model": "EMBEDDING_MODEL_NAME",
6 "messages": [
7 {
8 "role": "user",
9 "content": [
10 {"type": "text", "text": "A red bicycle leaning against a wall."},
11 {
12 "type": "image_url",
13 "image_url": {
14 "url": "data:image/jpeg;base64,your_base64_encoded_image"
15 }
16 }
17 ]
18 }
19 ],
20 "encoding_format": "float"
21}'POST /embeddings (배치 대화)
messages에 대화 배열을 전달하여 한 요청에서 최대 20개의 대화를 임베딩합니다. 각 대화는 비어 있지 않은 메시지 배열이어야 합니다.
1curl -X POST https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer your_api_key" \
4-d '{
5 "model": "EMBEDDING_MODEL_NAME",
6 "messages": [
7 [
8 {"role": "user", "content": "First conversation to embed."}
9 ],
10 [
11 {"role": "user", "content": "Second conversation to embed."}
12 ]
13 ]
14}'