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)

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)

Integrations

Connect and use third-party services (Gmail, Slack, etc.) through your NextToken account.

from nexttoken import NextToken

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

# List connected integrations
integrations = client.integrations.list()
print(integrations)

# List available actions for an app
actions = client.integrations.list_actions("gmail")
print(actions)

# Invoke a function
result = client.integrations.invoke(
    app="gmail",
    function_key="gmail-send-email",
    args={
        "to": "user@example.com",
        "subject": "Hello",
        "body": "Hello from NextToken!"
    }
)
print(result)

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.2.0.tar.gz (3.1 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.2.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nexttoken-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ed6afd85b2455cce32cff2c434ebaed845bc978dbeb51f2527d64b5d5c83e8fd
MD5 262e40a3b6bb19b6da063d0a2ce892aa
BLAKE2b-256 96f5831daa2b12c02dd6409fad928e1ca066fbe73c6c53dadf9caf6b2236940f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nexttoken-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9327c64652e8b7175bc0095428998d010436742188e55ab1332b847b83637279
MD5 65303fc86d9401c4d903ed51eed4d2f8
BLAKE2b-256 ad535c2593dbc9346af56176ba2a94a547e128b70b9dfae9da787df481e3e67a

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