Skip to navigation

OpenAI SDK

Install

pip install openai

Set up the client

import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.hi.hyperflow.fun/v1",
api_key=os.environ["HYPERFLOW_API_KEY"],
)
response = client.chat.completions.create(
model="openai/gpt-6-luna",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Set OPENAI_BASE_URL and OPENAI_API_KEY in the environment instead, and OpenAI() picks them up with no arguments. Useful for tools built on the SDK that don’t expose a base URL setting.

What works

SDK methodHyperFlow HI
chat.completions.create / .parse / .streamYes. See Streaming, Tool calling, Structured outputs
embeddings.createEndpoint ready; no models listed yet. See Embeddings
images.generate, images.editEndpoint ready; no models listed yet. See Image generation
videos.create, .retrieve, .list, .download_content / .downloadContentEndpoint ready; no models listed yet. See Video generation
models.listYes, the models you can call
responses, audio, moderations, files, batches, assistantsNot available

Errors and retries

The SDK raises its usual exceptions with HyperFlow HI’s message, for example openai.APIStatusError with status 402 for a low balance. It retries 429 and 5xx by itself. See Errors.