← all repositories
RageAgainstThePixel/com.openai.unity

OpenAI in Unity without the official SDK

A community-built UPM package that wraps OpenAI's REST API for Unity developers who need chat, DALL-E, realtime voice, and assistants in their games.

com.openai.unity
Velocity · 7d
+0.3
★ / day
Trend
steady
star history

What it does

This is an unofficial C# client for OpenAI’s API, packaged specifically for Unity via OpenUPM. It covers the full surface area: chat completions with streaming and function calling, image generation and editing, audio transcription/translation/speech, embeddings, fine-tuning, the Assistants API with threads and vector stores, and even the newer realtime voice API. Authentication is flexible—constructor, ScriptableObject, config file, or environment variables—and it also supports Azure OpenAI deployments.

The interesting bit

The package is actually a thin Unity wrapper around the author’s standalone OpenAI-DotNet library, which means the heavy lifting stays framework-agnostic. The Unity-specific value is in the UPM packaging, ScriptableObject-based configuration, and the dependency chain of utility packages for async, websockets, REST, and audio encoding.

Key highlights

  • Full API coverage including GPT-4o, DALL-E 3, realtime sessions, and Assistants with vector stores
  • Streaming support for chat, assistants, and audio (text-to-speech)
  • Four auth methods, including Unity ScriptableObjects and .openai config files
  • Azure OpenAI support with Active Directory authentication
  • Distributed through OpenUPM; one-line install via openupm add com.openai.unity

Caveats

  • Git URL installation requires manually adding five separate utility dependencies; the README warns about this explicitly
  • The ScriptableObject auth method carries a bolded warning about accidentally checking API keys into source control
  • Requires Unity 2021.3 LTS or newer; no mention of older version support

Verdict

Unity developers who want OpenAI features without building their own HTTP client should grab this. If you’re not using Unity, use the underlying OpenAI-DotNet library directly instead—this package adds no value outside the editor.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.