Skip to main content

Introduction

Using Simli Auto (our end-to-end API) is awesome! But it can be a bit difficult to tailor it out for your needs. You may have a custom knowledge base, a RAG powered system, using your fine-tuned LLM that’s the best doctor or tutor ever known to mankind that you self-host, or just want to use a model that we don’t readily support. If that’s you, you’re in the right place. There’s a fun trick you may already know: the DeepSeek API docs tell you to use the OpenAI SDK as if it were DeepSeek’s own. You give it DeepSeek’s base URL and API key, and it works as if nothing weird is going on. That works because DeepSeek, like a lot of LLM API providers, copied OpenAI’s API design. OpenAI’s API has a lot going on, but everyone copied the 3 essential parts: the request path (/chat/completions), the request body, and the streamed response. TL;DR: if your API works with the OpenAI SDK (try it with the Python or JS SDK), pass Simli its base URL, an API key and the model name in llmConfig, with provider set to "User", and you’re golden! The base URL must use HTTPS.
customLLMConfig (baseURL, llmAPIKey, model) still works but is deprecated: use llmConfig.

The basic OpenAI request

Simli calls your API the way the OpenAI SDK does: POST {baseURL}/chat/completions, with the header Authorization: Bearer <your apiKey> and a body like this:
and the response(s)
created is a Unix timestamp and object is always the literal chat.completion.chunk. Response has the mimetype text/event-stream and above is used for all chunks. You must ensure that the text body is correctly formatted. Additionally, you must indicate that your response is done by sending a DONE frame. All responses are followed by 2 newline delimiters. Using FastAPI for example, you would have an async generator looking like this:
Here’s an example server sending out a mock response with FastAPI, which can be simply run using python app.py and passing the hosting URL to Simli. (more examples in other languages coming soon)
and another example, wrapping the OpenAI SDK on the server