NeonAPI Docs
Connect your tools

Python SDK

Practical guidance for using NeonAPI.

Install and configure

python -m pip install openai
export NEON_API_KEY="YOUR_API_KEY"

Chat Completions

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["NEON_API_KEY"],
    base_url="https://neon-api.com/v1",
)
result = client.chat.completions.create(
    model="YOUR_MODEL_ID",
    messages=[{"role": "user", "content": "Hello"}],
)
print(result.choices[0].message.content)

Responses

For a model that supports Responses, use the same client and call client.responses.create(model="YOUR_MODEL_ID", input="Hello"). Read result.output_text from the returned response.

Set an application timeout appropriate to the model. Inspect the SDK's retry configuration before adding another retry loop, especially for billable generation requests.

Official Python SDK