Overview
Morph provides an OpenAI-compatible API for generating embeddings from code and text. State of the art on code retrieval tasks with our latestmorph-embedding-v4 model.
Example Request
Model Selection
We recommend usingmorph-embedding-v4 for the best performance on code retrieval tasks. This model offers:
- State-of-the-Art Performance: Achieves SoTA results across all coding benchmarks for accuracy:speed ratio
- 1536 Dimensions: Optimal dimensionality for rich semantic representation while maintaining efficiency
- Unmatched Speed: Fastest inference in the market - no embedding model comes close on accuracy:speed
- Enhanced Context: Superior handling of longer code snippets and complex codebases
Input Format
The request accepts the following parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model ID to use for embedding generation. Use morph-embedding-v4 (latest). |
input | string or array | Yes | The text to generate embeddings for. Can be a string or an array of strings. |
encoding_format | string | No | The format in which the embeddings are returned. Options are float and base64. Default is float. |