OpenAI Embeddings API Integration Guide & Examples

MethodPathPurpose
POST/v1/embeddingsText embeddings
POST/v1/embeddings/multimodalMultimodal (text, image, and so on) embeddings
bash
curl https://api.modelgo.ai/v1/embeddings \
  -H "Authorization: Bearer $MODELGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<model>","input":"hello"}'

input can be a single string or an array of strings; the response follows the OpenAI Embeddings format.

OpenAI Multimodal Embeddings

bash
curl https://api.modelgo.ai/v1/embeddings/multimodal \
  -H "Authorization: Bearer $MODELGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<model>","input":[{"type":"text","text":"a cat"},{"type":"image_url","image_url":{"url":"https://example.com/cat.png"}}]}'
  • The content types input accepts depend on the model.
  • The response format depends on the model; follow the documentation of the model you use.
  • Streaming is not supported; usage is metered in text and image tokens.