A minimal Python client for the Impossibl AI API.
Impossibl is an AI gateway with self-serve inference.
Build with models from OpenAI, Anthropic, Google, and xAI through one OpenAI-compatible API. Change the model ID to try another provider, while keeping the same integration.
Impossibl brings your models together with one API key, unified usage and billing, and automatic provider fallbacks.
This package is a small client for the hosted Impossibl API. It extends the OpenAI Python client with Impossibl's endpoint and the IMPOSSIBL_API_KEY environment variable.
pip install impossibl export IMPOSSIBL_API_KEY="your-api-key" List available models:
from impossibl import Impossibl with Impossibl() as client: for model in client.models.list(): print(model.id) Generate a response using a model ID from the list:
import os from impossibl import Impossibl with Impossibl() as client: response = client.chat.completions.create( model=os.environ["IMPOSSIBL_MODEL"], messages=[{"role": "user", "content": "Hello!"}], ) print(response.choices[0].message.content) Set IMPOSSIBL_MODEL to your chosen model ID before running the second example. Model availability, pricing, and API credentials are managed by Impossibl. Generation requests may consume your account balance.
You can also pass api_key explicitly. OpenAI client options such as timeout, max_retries, and base_url are forwarded unchanged. An explicit key takes precedence over IMPOSSIBL_API_KEY; OPENAI_API_KEY is not used as a fallback.
This initial release provides a synchronous client. It does not create accounts or manage billing. API compatibility is determined by the Impossibl service.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.




