Accessing Assistant using Open AI chat API

:waving_hand: Jocelyn here, community manager –
Received this question from a community member and sharing the answer here as its helplful- feel free to weigh in with your own experiences!

Hi. I’m unclear on if I create an Assistant, what’s a way to access it using standard Open AI chat API, not Assistant API? For example, mattermost-plugin-ai doesn’t have Assistant API implemented yet. Is a proxy like LiteLLM the recommend solution then?

Pinecone provides an OpenAI-compatible chat interface specifically for this use case. Here’s how to use it:

  1. Copy the base URL for your Assistant from the Assistant Playground in the console
  2. Use the OpenAI client with your Pinecone Assistant by changing just the base URL:

python

assistant_name = "learn-assistant"  host = "https://prod-1-data.ke.pinecone.io" # This is what you copied from Assistant Consolebase_url = f"{host}/assistant/chat/{assistant_name}"
from openai import OpenAIoai_client = OpenAI(api_key=YOUR_API_KEY, base_url=base_url)
msg = {    "role": "user",    "content": "What is the maximum speed of the DJI mini 2?"}resp = oai_client.chat.completions.create(    model="gpt-4o",    messages=[msg])

This interface is based on the OpenAI Chat Completion API and is designed to be [compatible with existing OpenAI integrations(Chat through the OpenAI-compatible interface - Pinecone Docs). The responses will include citations in a markdown format.

we also offer these resources