Assistants
BVE Gateway provides full pass-through support for the OpenAI Assistants v2 API.
Endpoints
Section titled “Endpoints”GET /v1/assistantsPOST /v1/assistantsGET /v1/assistants/:assistant_idPOST /v1/assistants/:assistant_idDELETE /v1/assistants/:assistant_id
POST /v1/threadsGET /v1/threads/:thread_idPOST /v1/threads/:thread_idDELETE /v1/threads/:thread_id
GET /v1/threads/:thread_id/messagesPOST /v1/threads/:thread_id/messagesGET /v1/threads/:thread_id/messages/:message_id
POST /v1/threads/:thread_id/runsGET /v1/threads/:thread_id/runs/:run_idPOST /v1/threads/:thread_id/runs/:run_id/cancelGET /v1/threads/:thread_id/runs/:run_id/stepsAll require Authorization: Bearer sk-bve-YOUR_KEY.
Many operations also require the OpenAI-Beta: assistants=v2 header.
Create an assistant
Section titled “Create an assistant”curl https://api.bve.me/v1/assistants \ -H "Authorization: Bearer sk-bve-YOUR_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ -d '{ "model": "gpt-4o", "name": "My Assistant", "instructions": "You are a helpful assistant." }'Response:
{ "id": "asst_abc123", "object": "assistant", "created_at": 1716288000, "name": "My Assistant", "model": "gpt-4o", "instructions": "You are a helpful assistant.", "tools": [], "file_ids": []}Create a thread and run
Section titled “Create a thread and run”# Create a threadcurl -X POST https://api.bve.me/v1/threads \ -H "Authorization: Bearer sk-bve-YOUR_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ -d '{}'
# Add a messagecurl -X POST https://api.bve.me/v1/threads/thread_abc123/messages \ -H "Authorization: Bearer sk-bve-YOUR_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ -d '{ "role": "user", "content": "What is the capital of France?" }'
# Create a runcurl -X POST https://api.bve.me/v1/threads/thread_abc123/runs \ -H "Authorization: Bearer sk-bve-YOUR_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ -d '{ "assistant_id": "asst_abc123" }'OpenAI SDK
Section titled “OpenAI SDK”import OpenAI from 'openai';
const client = new OpenAI({ apiKey: 'sk-bve-YOUR_KEY', baseURL: 'https://api.bve.me/v1',});
// Create assistantconst assistant = await client.beta.assistants.create({ name: 'My Assistant', instructions: 'You are a helpful assistant.', model: 'gpt-4o',});
// Create thread and runconst thread = await client.beta.threads.create();
await client.beta.threads.messages.create(thread.id, { role: 'user', content: 'What is the capital of France?',});
const run = await client.beta.threads.runs.createAndPoll(thread.id, { assistant_id: assistant.id,});
if (run.status === 'completed') { const messages = await client.beta.threads.messages.list(thread.id); console.log(messages.data[0].content);}- All Assistants v2 routes are proxied directly — no gateway-level modifications.
- Include
OpenAI-Beta: assistants=v2on requests that require it. - For file-based tools, upload files first via the Files API.
- Vector stores for the file search tool are managed via the Vector Stores API.