Skip to main content

EVA Gateway Integration Guide

EVA Gateway provides a unified OpenAI-compatible API for multiple models. Use a single set of credentials to access large language models (LLM), speech recognition (ASR), and text-to-speech (TTS).

This guide helps you make your first request in minutes. Supported parameters, value ranges, and capabilities vary by model. See the relevant model details in the Model Hub.


Prerequisites​

1. Base URL​

https://eva-gateway.autoarkai.com

Note: LLM, Code, and audio services use different path prefixes.

  • LLM: https://eva-gateway.autoarkai.com/llm/v1
  • Code: https://eva-gateway.autoarkai.com/code/openai/v1
  • ASR/TTS (audio): https://eva-gateway.autoarkai.com/v1
  • Real-time ASR (WebSocket): wss://eva-gateway.autoarkai.com/v1/realtime

When using the OpenAI SDK, configure the Base URL for the service you are calling, as described below.

2. Get an API Key​

Create an API Key in the console. Keys have a format such as ak_xxxxxxxx....

3. Authentication​

Every request must include an API Key in the HTTP headers. Authentication is the same for all three integration methods:

Authorization: Bearer <YOUR_API_KEY>

4. Request Tracing​

EVA Gateway automatically generates a Trace ID for each request and returns it in the following response header:

autoark-trace-id: <TRACE_ID>

Method 1: EVA API​

Use any HTTP client without installing an SDK. Shell, Python, and TypeScript examples are provided below for each capability.

LLM​

Endpoint: POST /llm/v1/chat/completions. Request bodies, response bodies, and errors follow the standard OpenAI format for a consistent interface across models. Supported parameters and value ranges vary by model; see the relevant model details in the Model Hub. Add "stream": true to the request body to receive a standard OpenAI SSE streaming response.

curl https://eva-gateway.autoarkai.com/llm/v1/chat/completions \
-H "Authorization: Bearer $EVA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "volcengine-doubao-seed-2.0-mini",
"messages": [{"role": "user", "content": "Hello, introduce yourself in one sentence"}]
}'

Code API​

The Code API uses the same OpenAI-compatible request, response, and streaming protocols as the LLM API. Only the Base URL and available models differ:

  • POST /code/openai/v1/chat/completions
  • POST /code/openai/v1/responses

The Code API only supports models whose IDs end in -code. These models cannot be called through the regular LLM API. See EVA Gateway Model List: Code for available models.

ASR (Speech Recognition)​

Endpoint: POST /v1/audio/transcriptions. Requests use multipart/form-data, where file is the audio file and model is the ASR model ID. See EVA Gateway Parameters: ASR for parameters and response formats.

curl https://eva-gateway.autoarkai.com/v1/audio/transcriptions \
-H "Authorization: Bearer $EVA_API_KEY" \
-F "model=ark-asr-flash" \
-F "file=@sample.wav" \
-F "audio_format=wav" \
-F "sample_rate=16000"

TTS (Text-to-Speech)​

Endpoint: POST /v1/audio/speech. By default, the response contains raw audio bytes. See EVA Gateway Parameters: TTS for parameters and response formats.

curl https://eva-gateway.autoarkai.com/v1/audio/speech \
-H "Authorization: Bearer $EVA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ark-tts-flash",
"input": "Hello, welcome to EVA Gateway.",
"voice": "zh_female_vivian",
"response_format": "pcm"
}' \
--output output.pcm

WebSocket API​

The WebSocket API currently supports ASR only and implements a subset of the transcription events in the OpenAI Realtime API. See EVA Gateway WebSocket API for connection details, events, parameters, and request/response examples.


Method 2: OpenAI SDK​

If you already use the OpenAI SDK, point base_url to EVA Gateway to reuse your existing code as a drop-in replacement.

LLM and audio services use different path prefixes, so initialize a separate client for each.

Installation and Initialization​

Install the dependencies:

pip install openai

Initialize the clients:

from openai import OpenAI

# LLM uses /llm/v1
llm = OpenAI(api_key="EVA_API_KEY", base_url="https://eva-gateway.autoarkai.com/llm/v1")

# Audio (ASR/TTS) uses /v1
audio = OpenAI(api_key="EVA_API_KEY", base_url="https://eva-gateway.autoarkai.com/v1")

LLM​

resp = llm.chat.completions.create(
model="volcengine-doubao-seed-2.0-mini",
messages=[{"role": "user", "content": "Hello, introduce yourself in one sentence"}],
)
print(resp.choices[0].message.content)

ASR (Speech Recognition)​

Pass Gateway-specific parameters through extra_body in Python or additional fields in TypeScript.

with open("sample.wav", "rb") as f:
result = audio.audio.transcriptions.create(
model="ark-asr-flash",
file=f,
extra_body={"audio_format": "wav", "sample_rate": 16000},
)
print(result.text)

TTS (Text-to-Speech)​

resp = audio.audio.speech.create(
model="ark-tts-flash",
voice="zh_female_vivian",
input="Hello, welcome to EVA Gateway.",
response_format="pcm",
)
resp.stream_to_file("output.pcm")

Next Steps​

  • See EVA Gateway Parameters for endpoint parameters and their meanings. For model IDs, supported parameters, value ranges, and capabilities, see the model details in the Model Hub. Use the EVA model IDs shown there in your requests.