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/realtimeWhen 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.
- Shell
- Python
- TypeScript
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"}]
}'
import requests
resp = requests.post(
"https://eva-gateway.autoarkai.com/llm/v1/chat/completions",
headers={"Authorization": f"Bearer {EVA_API_KEY}", "Content-Type": "application/json"},
json={
"model": "volcengine-doubao-seed-2.0-mini",
"messages": [{"role": "user", "content": "Hello, introduce yourself in one sentence"}],
},
)
print(resp.json())
const resp = await fetch(
'https://eva-gateway.autoarkai.com/llm/v1/chat/completions',
{
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.EVA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'volcengine-doubao-seed-2.0-mini',
messages: [{ role: 'user', content: 'Hello, introduce yourself in one sentence' }],
}),
},
);
console.log(await resp.json());
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/completionsPOST /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.
- Shell
- Python
- TypeScript
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"
import requests
with open("sample.wav", "rb") as f:
resp = requests.post(
"https://eva-gateway.autoarkai.com/v1/audio/transcriptions",
headers={"Authorization": f"Bearer {EVA_API_KEY}"},
files={"file": ("sample.wav", f, "audio/wav")},
data={"model": "ark-asr-flash", "audio_format": "wav", "sample_rate": 16000},
)
print(resp.json())
import fs from 'fs';
const form = new FormData();
form.append('model', 'ark-asr-flash');
form.append('audio_format', 'wav');
form.append('sample_rate', '16000');
form.append('file', new Blob([fs.readFileSync('sample.wav')]), 'sample.wav');
const resp = await fetch(
'https://eva-gateway.autoarkai.com/v1/audio/transcriptions',
{
method: 'POST',
headers: { Authorization: `Bearer ${process.env.EVA_API_KEY}` },
body: form,
},
);
console.log(await resp.json());
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.
- Shell
- Python
- TypeScript
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
import requests
resp = requests.post(
"https://eva-gateway.autoarkai.com/v1/audio/speech",
headers={"Authorization": f"Bearer {EVA_API_KEY}", "Content-Type": "application/json"},
json={
"model": "ark-tts-flash",
"input": "Hello, welcome to EVA Gateway.",
"voice": "zh_female_vivian",
"response_format": "pcm",
},
)
with open("output.pcm", "wb") as f:
f.write(resp.content)
import fs from 'fs';
const resp = await fetch('https://eva-gateway.autoarkai.com/v1/audio/speech', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.EVA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'ark-tts-flash',
input: 'Hello, welcome to EVA Gateway.',
voice: 'zh_female_vivian',
response_format: 'pcm',
}),
});
fs.writeFileSync('output.pcm', Buffer.from(await resp.arrayBuffer()));
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:
- Python
- TypeScript
pip install openai
npm install openai
Initialize the clients:
- Python
- TypeScript
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")
import OpenAI from 'openai';
// LLM uses /llm/v1
const llm = new OpenAI({
apiKey: process.env.EVA_API_KEY,
baseURL: 'https://eva-gateway.autoarkai.com/llm/v1',
});
// Audio (ASR/TTS) uses /v1
const audio = new OpenAI({
apiKey: process.env.EVA_API_KEY,
baseURL: 'https://eva-gateway.autoarkai.com/v1',
});
LLM
- Python
- TypeScript
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)
const resp = await llm.chat.completions.create({
model: 'volcengine-doubao-seed-2.0-mini',
messages: [{ role: 'user', content: 'Hello, introduce yourself in one sentence' }],
});
console.log(resp.choices[0].message.content);
ASR (Speech Recognition)
Pass Gateway-specific parameters through extra_body in Python or additional fields in TypeScript.
- Python
- 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)
import fs from 'fs';
const result = await audio.audio.transcriptions.create({
model: 'ark-asr-flash',
file: fs.createReadStream('sample.wav'),
// @ts-expect-error Gateway-specific parameters
audio_format: 'wav',
sample_rate: 16000,
});
console.log(result.text);
TTS (Text-to-Speech)
- Python
- TypeScript
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")
import fs from 'fs';
const resp = await audio.audio.speech.create({
model: 'ark-tts-flash',
voice: 'zh_female_vivian',
input: 'Hello, welcome to EVA Gateway.',
response_format: 'pcm',
});
fs.writeFileSync('output.pcm', Buffer.from(await resp.arrayBuffer()));
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.