Skip to main content

Jup Python SDK

A Python SDK designed for seamless interaction with the Jupiter Ultra API, the simplest and safest way to trade on Solana.
With Ultra API, you don't need to manage or connect to any RPC endpoints, or deal with complex configurations.
Everything from getting quotes to transaction execution happens directly through the API.

Or as we like to say around here:
"RPCs are for NPCs."

For a deeper understanding of the Ultra API, including its features and benefits, check out the Ultra API Docs.

Installation

To install the SDK in your project, run:

pip install jup-python-sdk

Quick Start

Below is a simple example that shows how to fetch and execute an Ultra order with the Jup Python SDK:

from dotenv import load_dotenv
from jup_python_sdk.clients.ultra_api_client import UltraApiClient
from jup_python_sdk.models.ultra_api.ultra_order_request_model import UltraOrderRequest

load_dotenv()
client = UltraApiClient()

order_request = UltraOrderRequest(
   input_mint="So11111111111111111111111111111111111111112",  # WSOL
   output_mint="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",  # USDC
   amount=10000000,  # 0.01 WSOL
   taker=client._get_public_key(),
)

try:
   client_response = client.order_and_execute(order_request)
   signature = str(client_response["signature"])

   print("Order and Execute API Response:")
   print(f"  - Status: {client_response.get('status')}")
   if client_response.get("status") == "Failed":
      print(f"  - Code: {client_response.get('code')}")
      print(f"  - Error: {client_response.get('error')}")

   print(f"  - Transaction Signature: {signature}")
   print(f"  - View on Solscan: https://solscan.io/tx/{signature}")

except Exception as e:
   print("Error occurred while processing the swap:", str(e))
finally:
   client.close()

You can find additional code examples and advanced usage scenarios in the examples folder. These examples cover every Ultra API endpoint and should help you get up and running quickly.

Setup Instructions

Before using the SDK, please ensure you have completed the following steps:

  1. Environment Variables:
    Set up your required environment variables.
    Example (base58 string or uint8 array supported):
    # Base58 format
    export PRIVATE_KEY=your_base58_private_key_here
    
    # OR as a uint8 array (advanced)
    export PRIVATE_KEY=[10,229,131,132,213,96,74,22,...]
    

Note: PRIVATE_KEY can be either a base58-encoded string (default Solana format), or a uint8 array (e.g. [181,99,240,...]). The SDK will automatically detect and parse the format.

  1. Optional Configuration:
    Depending on your credentials and setup, you have a couple of options for initializing the UltraApiClient:

    • Custom Private Key Environment Variable:
      By default, the SDK looks for your private key in an environment variable named PRIVATE_KEY.
      If you use a different environment variable name, you can specify it explicitly:

      from jup_python_sdk.clients.ultra_api_client import UltraApiClient
      
      client = UltraApiClient(private_key_env_var="YOUR_CUSTOM_ENV_VAR")
      

      This tells the SDK to read your private key from the environment variable you want.

    • Using an API Key for Enhanced Access:
      If you have an API key from the Jupiter Portal, you can pass it directly when creating the client:

      from jup_python_sdk.clients.ultra_api_client import UltraApiClient
      
      client = UltraApiClient(api_key="YOUR_API_KEY")
      

      When you supply an API key, the library will call the https://api.jup.ag/ API rather than the default https://lite-api.jup.ag/ API.

Disclaimer

🚨 This project is actively worked on.
While we don't expect breaking changes as the SDK evolves, we recommend you stay updated with the latest releases.
Any important updates will be announced in the Discord server.

Metadata

Release files for jup-python-sdk 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jup-python-sdk 1.2.0
File Size Uploaded
jup_python_sdk-1.2.0.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jup-python-sdk 1.2.0
File Interpreter ABI Platform
jup_python_sdk-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.7 kB

Release files / jup_python_sdk-1.2.0.tar.gz

Download URL jup_python_sdk-1.2.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ff34fcdf9031d6328b3cb5324d6b54ac8ad7f95c94c04a2758418bae5742f6fd
BLAKE2b-256 checksum
How to use checksums
62973a535fc0c4559e88058cf32c64ea082218c79c84f9f14b8b58898639b527
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.9.25 Linux/6.11.0-1018-azure

Release files / jup_python_sdk-1.2.0-py3-none-any.whl

Download URL jup_python_sdk-1.2.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f09c3c4bd571e679babd976f02f6b9df542893a5aa24e04c65433ce0f87c358
BLAKE2b-256 checksum
How to use checksums
451e0eec676cba519c41045c9aed9798e142f36a1205780ee3c862f861b5beda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.9.25 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page