Skip to content
← Back to guides

Generic SDKs (Python / Node.js)

To call 6090ti from your own code, use the official OpenAI or Anthropic SDK and change only the endpoint and key. The same key works with both SDKs; pick by the model you call:

ModelSDKBase URL
Claude modelsAnthropic SDKhttps://api.6090ti.com
GPT and other modelsOpenAI SDKhttps://api.6090ti.com/v1

Before you start

  • You have an account, a topped-up balance and an API key created in the console.
  • Request /v1/models with this key and choose a model from the returned list. The pricing page shows display prices only. The model is shown below as <model>.
  • Keep the key in the environment variable P6090TI_API_KEY, not in your code.
# macOS / Linux
export P6090TI_API_KEY="<your key>"

# Windows (reopen the terminal afterwards)
setx P6090TI_API_KEY "<your key>"

Python

Install:

pip install openai anthropic

OpenAI SDK (GPT and other models)

import os
from openai import OpenAI

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

resp = client.chat.completions.create(
    model="<model>",
    messages=[{"role": "user", "content": "Introduce yourself in one sentence"}],
)
print(resp.choices[0].message.content)

Streaming (show output as it is generated):

stream = client.chat.completions.create(
    model="<model>",
    messages=[{"role": "user", "content": "Write a four-line poem"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

The OpenAI SDK can also use the Responses API:

resp = client.responses.create(model="<model>", input="Reply with OK only")
print(resp.output_text)

Anthropic SDK (Claude models)

import os
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.6090ti.com",
    api_key=os.environ["P6090TI_API_KEY"],
)

msg = client.messages.create(
    model="<model>",
    max_tokens=512,
    messages=[{"role": "user", "content": "Introduce yourself in one sentence"}],
)
print(msg.content[0].text)

Streaming:

with client.messages.stream(
    model="<model>",
    max_tokens=512,
    messages=[{"role": "user", "content": "Write a four-line poem"}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

Node.js

Install:

npm install openai @anthropic-ai/sdk

OpenAI SDK (GPT and other models)

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.6090ti.com/v1",
  apiKey: process.env.P6090TI_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "<model>",
  messages: [{ role: "user", content: "Introduce yourself in one sentence" }],
});
console.log(resp.choices[0].message.content);

Anthropic SDK (Claude models)

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.6090ti.com",
  apiKey: process.env.P6090TI_API_KEY,
});

const msg = await client.messages.create({
  model: "<model>",
  max_tokens: 512,
  messages: [{ role: "user", content: "Introduce yourself in one sentence" }],
});
console.log(msg.content[0].text);

These Node.js examples use ES modules. Save the file as .mjs, or set "type": "module" in package.json.

List available models

Request the model list with your key. It returns the models enabled for that key:

curl https://api.6090ti.com/v1/models \
  -H "Authorization: Bearer <your key>"

Common errors

  • 401: the key is wrong, or the environment variable was not read.
  • 403 insufficient balance: top up and retry.
  • 404 model not available: the model name is wrong, or the model is not enabled for your key.
  • SDK does not match the model: use the Anthropic SDK and https://api.6090ti.com for Claude models, and the OpenAI SDK and https://api.6090ti.com/v1 for other models.
  • 429: too many requests or a busy upstream. Retry later; add backoff retries in your code.

See the API reference for full parameters and errors.