Docs / For renters
OpenAI SDK in Python and JavaScript
Use the official OpenAI libraries. Change the base URL and the key, nothing else.
Ballast has no SDK of its own. Use the official OpenAI libraries and change two things: the base URL and the key. Keep the key in an environment variable, never in source.
Terminalsh
Python
Terminalsh
hello.pypython
JavaScript
Terminalsh
hello.mjsjs
What works
POST /v1/chat/completions, streaming or not, andGET /v1/models. Those are the two endpoints on the base URL.- Text messages with the
system,userandassistantroles. The newerdeveloperrole is treated assystem. max_tokens(ormax_completion_tokens),temperature,top_p,stop(up to 4),seed,presence_penaltyandfrequency_penalty.stream_options.include_usage, so the last streamed chunk can carry token counts.
What does not
Tools and function calling, images, audio and files, n above 1, embeddings and the image endpoints are not offered. Ballast runs text chat on open models and nothing else, for now.
If a request carries a parameter Ballast cannot honour, it is refused with a 400 and the code unsupported_parameter. That is on purpose. You should never believe a feature worked when it was quietly dropped. See Errors.
Something here wrong or missing? Tell us on Support.