instructor-ainative
Pre-configured instructor client for structured output extraction using AINative's free LLM API.
Zero setup. Works with Llama 3.3 70B, Qwen3, DeepSeek 4, and Kimi K2 — all free.
Install
pip install instructor-ainative
Quick Start
from instructor_ainative import get_client
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
client = get_client() # Auto-provisions free API key
user = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct",
response_model=User,
messages=[{"role": "user", "content": "Extract: John is 30"}],
)
print(user) # User(name='John', age=30)
How It Works
instructor-ainative wraps instructor with a pre-configured OpenAI client pointing at AINative's free, OpenAI-compatible API. You get structured Pydantic output extraction from open-source models without any API key setup.
On first use, the package auto-provisions a free API key (72-hour TTL). Claim your account at ainative.studio/signup for permanent access.
Available Models
Use aliases or full model IDs:
from instructor_ainative import get_model, MODELS
# Aliases
get_model("llama") # meta-llama/Llama-3.3-70B-Instruct
get_model("qwen") # qwen3-coder-flash
get_model("deepseek") # deepseek-4-flash
get_model("kimi") # kimi-k2
Async Support
import asyncio
from instructor_ainative import get_async_client
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
async def main():
client = get_async_client()
user = await client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct",
response_model=User,
messages=[{"role": "user", "content": "Extract: John is 30"}],
)
print(user)
asyncio.run(main())
Configuration
API Key Resolution Order
- Explicit
api_keyparameter AINATIVE_API_KEYenvironment variableZERODB_API_KEYenvironment variable~/.zerodb/credentials.json(shared with ZeroDB ecosystem)- Auto-provision (free, 72-hour TTL)
Bring Your Own Key
export AINATIVE_API_KEY=your-key-here
# Or pass directly
client = get_client(api_key="your-key-here")
Custom Base URL
client = get_client(base_url="https://your-proxy.example.com/v1")
Instructor Mode
import instructor
client = get_client(mode=instructor.Mode.TOOLS) # Default is JSON mode
Complex Extraction
from instructor_ainative import get_client
from pydantic import BaseModel, Field
from typing import List
class Address(BaseModel):
street: str
city: str
state: str
zip_code: str = Field(description="5-digit ZIP code")
class Contact(BaseModel):
name: str
email: str
phone: str
addresses: List[Address]
client = get_client()
contact = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct",
response_model=Contact,
messages=[{
"role": "user",
"content": """
Extract contact info: Jane Smith, jane@example.com, 555-0123.
Lives at 123 Main St, Austin TX 78701 and
456 Oak Ave, Denver CO 80202.
"""
}],
)
Why instructor-ainative?
| Feature | instructor + OpenAI | instructor-ainative |
|---|---|---|
| Setup | Get API key, set env var | pip install and go |
| Cost | Pay per token | Free |
| Models | GPT-4o, etc. | Llama 70B, Qwen, DeepSeek |
| Structured output | Yes | Yes |
| Auto-provisioning | No | Yes |
License
MIT
Metadata
Release files for instructor-ainative 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| instructor_ainative-0.1.0.tar.gz | 9.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| instructor_ainative-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.0 kB
Release files / instructor_ainative-0.1.0.tar.gz
| Download URL | instructor_ainative-0.1.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2aeee2611e5b97064c28e5906176b2965ef1616dc8ef1b46eafc912b35e9a037
|
|
BLAKE2b-256 checksum How to use checksums |
57ab49444481962ad11adb26713654e764b1cd60bca3d94c3b686c9c13106ddc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / instructor_ainative-0.1.0-py3-none-any.whl
| Download URL | instructor_ainative-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
495e4e7bda7f7b011ed559ee032cde4125b5cf3d899c364e9f5869991e42ffa7
|
|
BLAKE2b-256 checksum How to use checksums |
0290e615bac805e1fa1d1e422048911609aaed85b3861694eee6eba98ae528c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for instructor-ainative 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.