Releases: leafo/lua-openai
Conversations API, file uploads, Batch API
Breaking Changes:
-
Default models updated to current generation
- Chat & Responses default model changed from
gpt-4.1togpt-5.4 - Embeddings default changed from
text-embedding-ada-002totext-embedding-3-small. Vectors are not comparable across models: pinmodel = "text-embedding-ada-002"or re-embed existing data if you rely on the old default completion()default changed from the retiredtext-davinci-003togpt-3.5-turbo-instruct
- Chat & Responses default model changed from
-
completion()no longer sets defaulttemperatureormax_tokens- Only explicitly provided parameters are sent to the API
-
ResponsesChatSessionnow forwards all session options with every request- Previously only
model,instructions, andtoolswere sent; options likereasoningandtemperaturewere silently dropped - Unknown keys stored in session options will now be rejected by the API
- Previously only
New Features:
-
Added Conversations API support for server-side conversation state
create_conversation(),conversation(),update_conversation(),delete_conversation()conversation_items(),add_conversation_items(),conversation_item(),delete_conversation_item()ResponsesChatSessionaccepts aconversationoption, used in place ofprevious_response_idchaining
-
Added file uploads and other multipart endpoints
upload_file()andfile_content()for uploading & downloading filesaudio_transcription()for speech to textimage_edit()for image editing with one or more input images- Encoding handled by the new
openai.multipartmodule
-
Added Batch API support
create_batch(),batch(),cancel_batch(),batches()- Combined with
upload_file()andfile_content()for the full request file → poll → results workflow
-
Added support for the
developerrole in messages for both Chat Completions and Responses APIs -
Added compatibility clients for more providers
openai.compat.anthropic,openai.compat.deepseek,openai.compat.mistral,openai.compat.moonshot,openai.compat.mimo
-
ChatSessionnow returns the raw API response as a second return value and stores it onchat.last_response
Improvements:
-
Responses API parsing no longer fails on unrecognized output item types
- Responses containing
reasoning,web_search_call, and other non-message items now parse correctly
- Responses containing
-
Updated examples and documentation to current models, removed
temperaturefrom introductory examples
Modern tool calling support
New Features:
-
Added modern tool-calling support to
ChatSession- Supports
tools,tool_choice, andparallel_tool_calls - Tool results can be sent back with
role = "tool"andtool_call_id
- Supports
-
Added per-request parameter overrides for session methods
chat:send(...)andchat:generate_response(...)now accept request-specific overridesResponsesChatSession:send(...)now supports the same pattern
-
Added new tool-calling examples
- New chat completions example in
examples/chat_completions/tools.lua - Updated Responses example to show a full tool-call round trip
- New chat completions example in
Improvements:
-
Improved
ResponsesChatSessionparity withChatSession- Better support for tool-call round trips using
function_call_output - Session usage and examples now align more closely across both APIs
- Better support for tool-call round trips using
-
Improved streaming tool-call handling
- Streaming tool-call deltas are aggregated into complete assistant messages
-
Expanded documentation and test coverage
- README now documents tool calling and per-request overrides
- Added tests for tool calls, streaming aggregation, and session overrides
OpenRouter compatibility client
New Features:
- Added OpenRouter compatibility client
require("openai.compat.openrouter")for OpenRouter API- See
examples/openrouter.luafor usage
Responses API, Gemini compatibility, simplified streaming
Breaking Changes:
-
ChatSessionno longer exported from main module- Use
require("openai.chat_completions").ChatSessioninstead
- Use
-
Default model changed from
gpt-3.5-turbotogpt-4.1 -
chat()streaming callback now receives(delta, raw)instead of(chunk)- Use
create_chat_completion()for the previous raw chunk behavior
- Use
New Features:
-
Added Responses API support
create_response(params): Create a new responseresponse(response_id): Get a response by IDdelete_response(response_id): Delete a responsecancel_response(response_id): Cancel a response
-
Added
ResponsesChatSessionfor conversational state with Responses API -
Added Gemini compatibility client
require("openai.compat.gemini")for Google Gemini API
-
Added
create_chat_completion()method for raw streaming behavior
Improvements:
-
SSE parsing moved to dedicated
openai.ssemodule -
Removed
lpegdependency in favor of simpler line-based SSE parsing
v1.4.3
Improved support for images & assistants
New Features:
-
Added support for image generation endpoint
- New method:
image_generation(params)
- New method:
-
Added new endpoints for Assistants API:
assistants(): Get list of assistantsthreads(): Get list of threadsthread_messages(thread_id): Get messages for a specific threaddelete_thread(thread_id): Delete a specific thread
-
Added new endpoints for managing files:
files(): Get list of filesfile(file_id): Get details of a specific filedelete_file(file_id): Delete a specific file
Improvements:
-
Updated content format to support image_url input for GPT Vision
- Added support for
image_urltype in content format
- Added support for
-
Made authorization optional
- Allows usage with local models that don't require API key
v1.2.0 - Support for chat with functions
OpenAI allows sending a list of function declarations that the LLM can decide to call based on the prompt. The function calling interface must be used with chat completions and the gpt-4-0613 or gpt-3.5-turbo-0613 models or later.
This update supports providing a function schema to the initialization of the chat session object.
The function result is then detected when parsing the response from a chat message.
See https://github.com/leafo/lua-openai/blob/main/examples/example5.lua or the README for a complete example.
v1.1.0 - Improved error message output for bad-status errors
Returned error messages will include the message from the server if available.
Full Changelog: v1.0.0...v1.1.0
v1.0.0
Initial release
luarocks install lua-openai
Full Changelog: https://github.com/leafo/lua-openai/commits/v1.0.0