Developer guide
Calling the API
Compatible API paths and the rules for streaming and audio
The CLEVI gateway's call paths are divided into the OpenAI-compatible specification and the Anthropic-compatible specification. Both use the same API key, and you can call conversational inference models through either one. Embedding and audio/voice paths exist only in the OpenAI-compatible specification; the Anthropic-compatible specification provides three paths: messages, count_tokens, and models.
You enable streaming with stream in the request body; embeddings and some models and paths do not support it. Audio and voice paths follow rules that differ from general inference, such as returning the audio directly and keeping artifacts in CleviDrive for 3 days.
Model IDs and the calls each model allows are on the Models page. Authentication headers and base URLs are on the Authenticating with an API key page.
Choosing a path
Choose a path based on what you want to do and the SDK you use. The paths in the table are relative to each specification's base URL.
| Task | Specification | Path |
|---|---|---|
| Conversational inference with the OpenAI SDK | OpenAI-compatible | POST /chat/completions or POST /responses |
| Conversational inference with the Anthropic SDK | Anthropic-compatible | POST /v1/messages |
| Generating embeddings | OpenAI-compatible | POST /embeddings |
| Speech synthesis, transcription, and voice management | OpenAI-compatible | Paths under /audio and /voices |
| Checking which models you can call | Both | GET /models |
OpenAI-compatible paths
OpenAI 호환 규격의 base URL은 https://platform.clevi.net/api/v2/aiservice/openai/v1 입니다. 요청과 응답 본문은 OpenAI 규격을 따릅니다. 아래 표는 추론과 모델 경로를 호스트 기준 전체 경로로 표기하며, 음성·보이스 경로는 뒤의 음성과 보이스 경로 절에 정리했습니다.
| Method | Path | Description |
|---|---|---|
| POST | /api/v2/aiservice/openai/v1/chat/completions | Requests conversational inference. Responds over SSE when stream is enabled. |
| POST | /api/v2/aiservice/openai/v1/responses | Calls using the Responses specification. Supports stream. |
| GET | /api/v2/aiservice/openai/v1/responses/{responseId} | Retrieves a single stored response. |
| GET | /api/v2/aiservice/openai/v1/responses/{responseId}/input_items | Lists the input items of a stored response. |
| POST | /api/v2/aiservice/openai/v1/responses/{responseId}/cancel | Cancels a response that is running in the background. |
| DELETE | /api/v2/aiservice/openai/v1/responses/{responseId} | Deletes a stored response. |
| POST | /api/v2/aiservice/openai/v1/completions | Requests a legacy text completion. Supports stream. |
| POST | /api/v2/aiservice/openai/v1/embeddings | Generates embeddings. Streaming is not supported. |
| GET | /api/v2/aiservice/openai/v1/models | Returns the list of models this key can call. |
| GET | /api/v2/aiservice/openai/v1/models/{modelId} | Retrieves a single model. Returns 404 if the model is not accessible. |
A minimal example that calls chat/completions. Replace sk-... with the key issued on the API keys page, and set model to an ID from the Models page.
curl https://platform.clevi.net/api/v2/aiservice/openai/v1/chat/completions \
-H "X-API-Key: sk-..." \
-H "Content-Type: application/json" \
-d '{
"model": "cip-5.5-im",
"messages": [{"role": "user", "content": "안녕하세요"}]
}'Other paths
The following paths are for diagnostics, legacy compatibility, and relaying.
| Path | Description |
|---|---|
| GET /api/v2/aiservice/openai/v1/healthz | Checks the status of the audio provider. |
| /api/v2/aiservice/openai/v1/api/status · /api/options · /api/generate · /outputs/{filename} | Legacy Cosa paths for status and options lookup, generation calls (multipart), and artifact download. |
| /api/v2/aiservice/openai/v1/{routeKey} (GET · POST · PUT · PATCH · DELETE) | Relays provider paths not listed above, with the gateway rules applied. chat/completions, completions, embeddings, and responses are handled by their dedicated paths, so calling them through the POST relay returns 404. |
요청과 응답 필드 전체는 OpenAPI 3.0 문서 https://platform.clevi.net/api/v2/console/openapi/cloud-inference-v1 에서 확인할 수 있습니다. 경로 목록은 이 문서에서 생성되며, 문서는 콘솔에 로그인한 세션으로만 열립니다. 같은 문서로 클라이언트를 생성할 수 있습니다.
Anthropic-compatible paths
Anthropic 호환 규격의 base URL은 https://platform.clevi.net/api/v2/aiservice/anthropic 이며, Anthropic SDK가 요청 경로에 /v1을 직접 추가합니다. 요청과 응답 본문은 Anthropic Messages 규격을 따릅니다.
| Method | Path | Description |
|---|---|---|
| POST | /api/v2/aiservice/anthropic/v1/messages | Calls using the Messages specification. Requires model, messages, and max_tokens, and supports stream. |
| POST | /api/v2/aiservice/anthropic/v1/messages/count_tokens | Estimates the input token count only, without billing. max_tokens is not required. |
| GET | /api/v2/aiservice/anthropic/v1/models | Returns a cursor-paginated list of models. limit must be between 1 and 1000; values outside that range return 400. |
| GET | /api/v2/aiservice/anthropic/v1/models/{modelId} | Retrieves a single model. Returns 404 if the model is not accessible. |
A minimal example that calls messages.
curl https://platform.clevi.net/api/v2/aiservice/anthropic/v1/messages \
-H "X-API-Key: sk-..." \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "cip-5.5-im",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "안녕하세요"}]
}'If you omit the anthropic-version header, the gateway uses 2023-06-01. The gateway passes the anthropic-version and anthropic-beta headers through unchanged.
Streaming (SSE)
When you set stream to true in the request body, the server responds with Server-Sent Events. Support varies by path and model as follows.
| Target | Behavior |
|---|---|
| OpenAI-compatible POST /chat/completions · POST /completions · POST /responses | Supports stream. |
| Anthropic-compatible POST /v1/messages | Supports stream. |
| POST /embeddings | Streaming is not supported. |
| Ivy search models (such as ivy-4-mm-search) | Even if stream is enabled, the server disables it and returns a single response. |
| GET /responses/{responseId}?stream=true | Returns 400. This path stays closed until usage for background responses can be metered exactly once. |
The following three headers are sent with the first chunk. After that, each chunk sends a data: line and flushes immediately; an event: line is included only when the upstream provides an event name.
- Content-Type: text/event-stream
- Cache-Control: no-cache
- X-Accel-Buffering: no
On the Anthropic-compatible path, each chunk pairs an event line with a data line.
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"안"}}chat/completions chunks arrive as data lines, and the final data: [DONE] is passed through unchanged.
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[...]}
data: [DONE]If an error occurs during streaming, the same error JSON as a regular call is sent as a single data: line, and the HTTP status code changes accordingly.
Audio and voice paths
The TTS, STT, and Cosa voice management paths are part of the OpenAI-compatible specification, and a few rules differ from general inference. See the Cosa table on the Models page for which models allow which paths.
| Method | Path | Description |
|---|---|---|
| POST | /api/v2/aiservice/openai/v1/audio/speech | Synthesizes text into speech and returns the audio directly. |
| POST | /api/v2/aiservice/openai/v1/audio/transcriptions | Transcribes audio into text (multipart). |
| POST | /api/v2/aiservice/openai/v1/audio/speech/clone | Synthesizes speech with a cloned voice (multipart). |
| GET | /api/v2/aiservice/openai/v1/voices | Returns the list of voices the caller can use. |
| POST | /api/v2/aiservice/openai/v1/voices | Registers a voice from an audio sample (multipart). |
| POST | /api/v2/aiservice/openai/v1/voices/design | Creates a synthetic voice from a text description. |
| DELETE | /api/v2/aiservice/openai/v1/voices/{voiceId} | Deletes a voice. Only the owner can delete it. |
The following rules apply only to audio and voice paths.
| Rule | Details |
|---|---|
| Binary delivery | Successful responses from audio/speech, audio/speech/clone, and outputs/{filename} stream the audio directly while saving it to CleviDrive at the same time. |
| Receipt headers | The response includes the X-Clevi-Drive-File-Id, X-Clevi-Drive-File-Version-Id, X-Clevi-Drive-Download-Url, X-Clevi-Drive-Expires-At, and X-Clevi-Drive-Retention-Days: 3 headers. |
| Product selection | audio/speech and audio/transcriptions select the Product from the model in the request body. Voice and diagnostic paths require the X-Product-Sku header or the product_sku query parameter. |
| Voice ownership | Cloned or registered voices belong to whoever created them. Attempting to synthesize with or delete another owner's voice returns 403, and the GET /voices list includes only your own voices. |
| Size and time limits | The request limit is 28 MiB, and the upstream call timeout is 5 minutes. |
| Provider congestion | When the upstream is busy, the gateway passes 409 through as is, along with the Retry-After value if one is provided. The gateway does not retry or queue the request. |