Catalog PyPI
Back to packageRELEASE DETAILS

0.1.0

PyPI

ainative-openai

Drop-in replacement for the OpenAI Python SDK — routes to AINative's free Llama, Qwen, DeepSeek & Kimi API.

ainativeauto-provisioningchat-completionclaudecursordeepseek-apiembeddingsfree-llm-apifree-tierllama-apiopenaiopenai-alternativeopenai-compatibleqwen-apistreamingtool-calling
All keywords (17)
windsurf
Published11 Jun 2026
Direct dependencies2
Transitive dependenciesNot calculated

README

Version 0.1.0 documentation

ainative-openai

Drop-in replacement for the OpenAI Python SDK that routes to AINative's free API — Llama, Qwen, DeepSeek, and Kimi models with zero configuration.

Install

pip install ainative-openai

Quick Start

Replace from openai import OpenAI with from ainative_openai import OpenAI. That's it.

from ainative_openai import OpenAI

client = OpenAI()  # auto-provisions a free API key

response = client.chat.completions.create(
    model="meta-llama/Llama-3.3-70B-Instruct",
    messages=[{"role": "user", "content": "Explain quantum computing in 3 sentences."}],
)
print(response.choices[0].message.content)

First run auto-provisions a free API key (72h expiry) and saves it to ~/.ainative/config.json. Follow the printed claim URL to get a permanent key.

Async

import asyncio
from ainative_openai import AsyncOpenAI

async def main():
    client = AsyncOpenAI()
    response = await client.chat.completions.create(
        model="qwen3-coder-flash",
        messages=[{"role": "user", "content": "Write a Python fibonacci generator"}],
    )
    print(response.choices[0].message.content)

asyncio.run(main())

Streaming

from ainative_openai import OpenAI

client = OpenAI()
stream = client.chat.completions.create(
    model="deepseek-4-flash",
    messages=[{"role": "user", "content": "Write a haiku about code"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Tool Calling

from ainative_openai import OpenAI

client = OpenAI()
response = client.chat.completions.create(
    model="meta-llama/Llama-3.3-70B-Instruct",
    messages=[{"role": "user", "content": "What's the weather in Austin?"}],
    tools=[{
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get weather for a city",
            "parameters": {
                "type": "object",
                "properties": {"city": {"type": "string"}},
                "required": ["city"],
            },
        },
    }],
)

Available Models

ModelID
Llama 3.3 70Bmeta-llama/Llama-3.3-70B-Instruct
Llama 4 Scoutmeta-llama/Llama-4-Scout-17B-16E-Instruct
Qwen3 Coder Flashqwen3-coder-flash
DeepSeek 4 Flashdeepseek-4-flash
Kimi K2kimi-k2

All models are free on AINative's API.

Authentication Priority

The client resolves API keys in this order:

  1. api_key argument
  2. AINATIVE_API_KEY environment variable
  3. OPENAI_API_KEY environment variable
  4. Saved key in ~/.ainative/config.json
  5. Auto-provision via instant-db (free, 72h expiry)

Configuration

# Explicit key
client = OpenAI(api_key="your-ainative-key")

# Custom base URL (self-hosted)
client = OpenAI(api_key="key", base_url="http://localhost:8000/v1")

# Environment variables
# AINATIVE_API_KEY=your-key
# AINATIVE_BASE_URL=https://custom.endpoint/v1

Migrating from OpenAI

- from openai import OpenAI
+ from ainative_openai import OpenAI

  client = OpenAI()
  response = client.chat.completions.create(
-     model="gpt-4",
+     model="meta-llama/Llama-3.3-70B-Instruct",
      messages=[{"role": "user", "content": "Hello!"}],
  )

Every feature of the official openai SDK works — this is a thin subclass that only changes the defaults.

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 2

Native requirements
2 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
openai
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
openai>=1.0runtime
requests
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
requests>=2.28runtime

Distribution files

2 collected
ainative_openai-0.1.0-py3-none-any.whl

bdist_wheel · 6.78 KB · Python py3

Source file
ainative_openai-0.1.0.tar.gz

sdist · 7.66 KB · Python source

Source file

Repository

PENDING
ainative-studio/ainative-openai-python

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:26 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:febf958e7ea8e00880da3255e9016cd169f5b764b5145e3e22fa716038d7a21c

Other collected versions

View all collected versions →