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" }'SDK examples
Section titled “SDK examples”Create an assistant
Section titled “Create an assistant”import OpenAI from 'openai';
const client = new OpenAI({ apiKey: 'sk-bve-YOUR_KEY', baseURL: 'https://api.bve.me/v1',});
const assistant = await client.beta.assistants.create({ name: 'My Assistant', instructions: 'You are a helpful assistant.', model: 'gpt-4o',});console.log(assistant.id);from openai import OpenAI
client = OpenAI( api_key="sk-bve-YOUR_KEY", base_url="https://api.bve.me/v1",)
assistant = client.beta.assistants.create( name="My Assistant", instructions="You are a helpful assistant.", model="gpt-4o",)print(assistant.id)Thread, messages, and run
Section titled “Thread, messages, and run”import OpenAI from 'openai';
const client = new OpenAI({ apiKey: 'sk-bve-YOUR_KEY', baseURL: 'https://api.bve.me/v1',});
// Create threadconst thread = await client.beta.threads.create();
// Add a messageawait client.beta.threads.messages.create(thread.id, { role: 'user', content: 'What is the capital of France?',});
// Create and poll the run to completionconst run = await client.beta.threads.runs.createAndPoll(thread.id, { assistant_id: 'asst_abc123',});
if (run.status === 'completed') { const messages = await client.beta.threads.messages.list(thread.id); console.log(messages.data[0].content);}from openai import OpenAI
client = OpenAI( api_key="sk-bve-YOUR_KEY", base_url="https://api.bve.me/v1",)
# Create threadthread = client.beta.threads.create()
# Add a messageclient.beta.threads.messages.create( thread.id, role="user", content="What is the capital of France?",)
# Create and poll the run to completionrun = client.beta.threads.runs.create_and_poll( thread.id, assistant_id="asst_abc123",)
if run.status == "completed": messages = client.beta.threads.messages.list(thread.id) print(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.
Next steps
Section titled “Next steps” Files Upload documents before using them with code interpreter or file search
Vector Stores Create a searchable knowledge base for the file search tool
Streaming Stream run events and assistant responses in real time via SSE
Rate Limits & Quotas Per-key request limits and Retry-After handling
Errors Full error code reference for pass-through API errors