Inference API
The inference API is compatible with the OpenAI API. Send each request with the header Authorization: Bearer <key>. The key must have the scope inference.
Endpoints#
| Method and path | Use |
|---|---|
POST /v1/chat/completions | Chat with a language model. See Chat completions. |
POST /v1/completions | Complete a text prompt. |
POST /v1/embeddings | Make vectors from text. See Embeddings. |
POST /v1/messages | The Anthropic Messages format, for shared models. |
GET /v1/models | List the shared models and your deployments. |
POST /v1/predict/<deployment ID> | Send a request to a custom deployment. |
Each parameter is in the API reference.
Use a deployment#
To send a request to your own deployment, use the deployment ID as the model.
curl "$EMBER_API_URL/v1/chat/completions" \
-H "Authorization: Bearer $EMBER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "dep_abc123", "messages": [{"role": "user", "content": "Hello"}]}'
If the deployment has zero replicas, the first request starts a replica. This request waits during the cold start.
Errors#
| Status | Meaning |
|---|---|
| 401 | The key is missing, not valid or revoked. |
| 402 | The organization is at its spend limit for this month. |
| 403 | The key does not have the necessary scope, or the organization is suspended. |
| 404 | The model or deployment does not exist. |
| 429 | The organization is above its rate limit. Wait for the time in Retry-After. |
| 503 | No replica is available. Send the request again later. |
| 504 | The model did not answer in time. |
Each error code and what to do is in Rate limits and errors.