OpenAI Embeddings API Integration Guide & Examples
| Method | Path | Purpose |
|---|---|---|
POST | /v1/embeddings | Text embeddings |
POST | /v1/embeddings/multimodal | Multimodal (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
inputaccepts 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.