POST/v1/embeddingsCreate embeddings
Creates embedding vectors representing the input text, using an OpenAI-compatible request and response format. Any SDK that supports OpenAI embeddings works by changing the base URL and API key.
Calling an asymmetric model
Some embedding models are asymmetric: they encode the same sentence differently depending on whether it is a search query or a stored document. When you call one, embed documents as-is (the default) and set extra.input_type to query for search queries, so the model applies its instruct prefix. Sending queries without it silently degrades retrieval quality. sionic-ai/comsat-embed-ko-8b-preview is asymmetric.
Headers
AuthorizationstringRequiredBearer YOUR_API_KEYx-opengateway-user-idstringOptionalx-opengateway-session-idstringOptionalRequest body
modelstringRequiredowner/model format, such as sionic-ai/comsat-embed-ko-8b-preview.inputstring or arrayRequired8,192 tokens; longer inputs are rejected with 400 (they are never silently truncated). Batches are limited to 128 inputs per request. Token ID arrays are not supported.encoding_formatstringOptionalfloat (default) or base64.dimensionsintegerOptionalcomsat-embed-ko-8b-preview are 2048 and 4096 (default). Other values are rejected with 400.userstringOptionalextraobjectOptional🔌extra_body.input_typestring🔌query or document (default). Applies to the whole batch. Use query when embedding search queries for retrieval.
fallbacksarray🔌List of fallback model IDs to try if the primary target fails.
Returns
Returns an OpenAI-compatible embeddings response.
objectstringlist.dataarraydata[].embeddingarray or stringencoding_format is base64.data[].indexintegermodelstringusageobjectprompt_tokens equals total_tokens. Query encoding includes the model's instruct prefix tokens.Request
# Document embedding (default)curl https://apis.opengateway.ai/v1/embeddings \-H "Content-Type: application/json" \-H "Authorization: Bearer $API_KEY" \-d '{"model": "sionic-ai/comsat-embed-ko-8b-preview","input": "Seoul is the capital of South Korea."}'# Query embedding (for search queries)curl https://apis.opengateway.ai/v1/embeddings \-H "Content-Type: application/json" \-H "Authorization: Bearer $API_KEY" \-d '{"model": "sionic-ai/comsat-embed-ko-8b-preview","input": "What is the capital of South Korea?","extra": {"input_type": "query"}}'
Response
{"object": "list","data": [{"object": "embedding","index": 0,"embedding": [0.0388, 0.0105, -0.0030, ...]}],"model": "sionic-ai/comsat-embed-ko-8b-preview","usage": {"prompt_tokens": 7,"total_tokens": 7}}