Skip to content

Releases: leafo/lua-openai

Conversations API, file uploads, Batch API

11 Jun 18:26
v1.8.0

Choose a tag to compare

Breaking Changes:

  1. Default models updated to current generation

    • Chat & Responses default model changed from gpt-4.1 to gpt-5.4
    • Embeddings default changed from text-embedding-ada-002 to text-embedding-3-small. Vectors are not comparable across models: pin model = "text-embedding-ada-002" or re-embed existing data if you rely on the old default
    • completion() default changed from the retired text-davinci-003 to gpt-3.5-turbo-instruct
  2. completion() no longer sets default temperature or max_tokens

    • Only explicitly provided parameters are sent to the API
  3. ResponsesChatSession now forwards all session options with every request

    • Previously only model, instructions, and tools were sent; options like reasoning and temperature were silently dropped
    • Unknown keys stored in session options will now be rejected by the API

New Features:

  1. 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()
    • ResponsesChatSession accepts a conversation option, used in place of previous_response_id chaining
  2. Added file uploads and other multipart endpoints

    • upload_file() and file_content() for uploading & downloading files
    • audio_transcription() for speech to text
    • image_edit() for image editing with one or more input images
    • Encoding handled by the new openai.multipart module
  3. Added Batch API support

    • create_batch(), batch(), cancel_batch(), batches()
    • Combined with upload_file() and file_content() for the full request file → poll → results workflow
  4. Added support for the developer role in messages for both Chat Completions and Responses APIs

  5. Added compatibility clients for more providers

    • openai.compat.anthropic, openai.compat.deepseek, openai.compat.mistral, openai.compat.moonshot, openai.compat.mimo
  6. ChatSession now returns the raw API response as a second return value and stores it on chat.last_response

Improvements:

  1. 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
  2. Updated examples and documentation to current models, removed temperature from introductory examples

Modern tool calling support

16 Mar 23:04

Choose a tag to compare

New Features:

  1. Added modern tool-calling support to ChatSession

    • Supports tools, tool_choice, and parallel_tool_calls
    • Tool results can be sent back with role = "tool" and tool_call_id
  2. Added per-request parameter overrides for session methods

    • chat:send(...) and chat:generate_response(...) now accept request-specific overrides
    • ResponsesChatSession:send(...) now supports the same pattern
  3. 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

Improvements:

  1. Improved ResponsesChatSession parity with ChatSession

    • Better support for tool-call round trips using function_call_output
    • Session usage and examples now align more closely across both APIs
  2. Improved streaming tool-call handling

    • Streaming tool-call deltas are aggregated into complete assistant messages
  3. 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

20 Jan 22:17

Choose a tag to compare

New Features:

  1. Added OpenRouter compatibility client
    • require("openai.compat.openrouter") for OpenRouter API
    • See examples/openrouter.lua for usage

Responses API, Gemini compatibility, simplified streaming

17 Jan 04:10

Choose a tag to compare

Breaking Changes:

  1. ChatSession no longer exported from main module

    • Use require("openai.chat_completions").ChatSession instead
  2. Default model changed from gpt-3.5-turbo to gpt-4.1

  3. chat() streaming callback now receives (delta, raw) instead of (chunk)

    • Use create_chat_completion() for the previous raw chunk behavior

New Features:

  1. Added Responses API support

    • create_response(params): Create a new response
    • response(response_id): Get a response by ID
    • delete_response(response_id): Delete a response
    • cancel_response(response_id): Cancel a response
  2. Added ResponsesChatSession for conversational state with Responses API

  3. Added Gemini compatibility client

    • require("openai.compat.gemini") for Google Gemini API
  4. Added create_chat_completion() method for raw streaming behavior

Improvements:

  1. SSE parsing moved to dedicated openai.sse module

  2. Removed lpeg dependency in favor of simpler line-based SSE parsing

v1.4.3

05 Dec 20:55

Choose a tag to compare

  • Better support for API compatible endpoints like ollm
  • Don't send values where defaults are available (fixes issue with o1-preview failing due to temperature parameter)5

Improved support for images & assistants

30 Jul 22:56

Choose a tag to compare

New Features:

  1. Added support for image generation endpoint

    • New method: image_generation(params)
  2. Added new endpoints for Assistants API:

    • assistants(): Get list of assistants
    • threads(): Get list of threads
    • thread_messages(thread_id): Get messages for a specific thread
    • delete_thread(thread_id): Delete a specific thread
  3. Added new endpoints for managing files:

    • files(): Get list of files
    • file(file_id): Get details of a specific file
    • delete_file(file_id): Delete a specific file

Improvements:

  1. Updated content format to support image_url input for GPT Vision

    • Added support for image_url type in content format
  2. Made authorization optional

    • Allows usage with local models that don't require API key

v1.2.0 - Support for chat with functions

16 Jun 17:06

Choose a tag to compare

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

19 May 19:49

Choose a tag to compare

Returned error messages will include the message from the server if available.

Full Changelog: v1.0.0...v1.1.0

v1.0.0

02 May 06:59

Choose a tag to compare

Initial release

luarocks install lua-openai

Full Changelog: https://github.com/leafo/lua-openai/commits/v1.0.0