USA Inference Labs

Quickstart

Authenticate to USA Inference Labs, list available model aliases, and run your first OpenAI-compatible chat completion in Python.

You’ll need an issued USA Inference Labs API key. Set it in your shell or deployment secret manager as USA_INFERENCE_LABS_API_KEY. Run these examples from your terminal or server, where you can keep the key out of client-side code and logs.

Verify your key

Request the current model list.

curl --fail-with-body --silent --show-error \
  https://api.usainferencelabs.com/v1/models \
  -H "Authorization: Bearer ${USA_INFERENCE_LABS_API_KEY}"

A successful response includes a data array. Use an alias from that array as the model in your chat request.

Send a chat completion

Install the Python SDK.

python -m pip install openai

Point the client at the USA Inference Labs base URL and send a short prompt.

import os

from openai import OpenAI

client = OpenAI(
    base_url="https://api.usainferencelabs.com/v1",
    api_key=os.environ["USA_INFERENCE_LABS_API_KEY"],
)

response = client.chat.completions.create(
    model="coder-v1",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    max_tokens=32,
    stream=False,
)

print(response.choices[0].message.content)

For raw HTTP examples and a live request console, open the API reference.