Skip to main content

NextToken SDK - Simple client for the NextToken APIs and Gateway

Project description

NextToken Python SDK

Simple Python client for the NextToken Gateway - an OpenAI-compatible LLM proxy.

Installation

pip install nexttoken

Quick Start

from nexttoken import NextToken

# Initialize with your API key
client = NextToken(api_key="your-api-key")

# Use like the OpenAI SDK
response = client.chat.completions.create(
    model="gpt-4o",  # or "claude-3-5-sonnet", "gemini-2.5-flash"
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

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

Using with OpenAI SDK Directly

Since the Gateway is OpenAI-compatible, you can also use the OpenAI SDK:

from openai import OpenAI

client = OpenAI(
    api_key="your-nexttoken-api-key",
    base_url="https://gateway.nexttoken.co/v1"
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)

Available Models

  • OpenAI models
  • Anthropic models
  • Gemini models
  • Openrouter models

Embeddings

from nexttoken import NextToken

client = NextToken(api_key="your-api-key")

response = client.embeddings.create(
    model="text-embedding-3-small",
    input="Your text to embed"
)

print(response.data[0].embedding)

Get Your API Key

Sign up at nexttoken.co and get your API key from Settings.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexttoken-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexttoken-0.1.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file nexttoken-0.1.0.tar.gz.

File metadata

  • Download URL: nexttoken-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for nexttoken-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d75522d22da2c9731ebc8dd77e43add928541c99cbc70e640ada3763541e6ad
MD5 59c9554504d0b2be3a1e3d5735cae4ca
BLAKE2b-256 27ef50c5cb3e533eabea223f8104df01018f50ed1e9811471c84e1947f5d4fa2

See more details on using hashes here.

File details

Details for the file nexttoken-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nexttoken-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for nexttoken-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1dfe2e8ec8a0d335fe3a87b14a39126ff0441dc926f4183bbc1ddc93eed2edeb
MD5 0ed0d32f440bbd78cdfb4e18e6dffbda
BLAKE2b-256 60648d5a005307d62a378ce0561bda0b21d56708c1cf952684d4b6f712f4b209

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page