Skip to main content
Poolside provides an OpenAI-compatible API for model requests. You can call it directly, use the official OpenAI SDK, or reach Poolside models through OpenRouter’s API or SDK. You can also use API keys with the Poolside Agent CLI in non-interactive environments, such as scripts and CI jobs.

Set the OpenAI-compatible API base URL

The OpenAI-compatible API base URL depends on how you access Poolside. The examples on this page use the base URL for Poolside Platform. OpenRouter uses an OpenAI-compatible API, so the same request shape and OpenAI SDK examples work when you switch the base URL and API key to OpenRouter. For self-managed Poolside model inference, you can use LiteLLM as an OpenAI-compatible provider gateway in front of model-server /v1 endpoints. See Use LiteLLM with Poolside model inference.
The Poolside Platform API is served at /v1. A Poolside deployment serves the OpenAI-compatible API at /openai/v1. When you switch between them, update the path as well as the host.

Authenticate API requests

Authenticate API requests with an API key sent as a Bearer token.

Get and set your API key

Where you get your API key depends on how you access Poolside.
  • Poolside Platform: Use this for the fastest way to get a free developer API key for models hosted by Poolside. Go to platform.poolside.ai, sign in, open the API Keys tab, and click New key.
  • OpenRouter: Use this if you already use OpenRouter or need paid access to Poolside models. Go to OpenRouter API keys, sign in, and create an API key.
  • Poolside deployment: Use the API key or token from your Poolside administrator.
  • OpenAI-compatible provider: Use the API key from the provider you configure.
If you use Poolside Agent CLI, see Log in to Poolside instead. Save your key as an environment variable so it is never hard-coded into your scripts. The examples below read from these variables.
The examples read these values with os.environ in Python, process.env in TypeScript, and $POOLSIDE_API_KEY in shell.

Send the key with Bearer authentication

Send your API key in the Authorization header:
API keys are secrets. Store them securely and never commit them to source control.

Make your first request

Choose the approach that fits your setup. Each approach sends the same request, so you only need one.

Direct HTTP request

Send a Chat Completions request. To find model IDs for your access method, see List available models.
To send the same request through OpenRouter, use https://openrouter.ai/api/v1/chat/completions as the URL and your OPENROUTER_API_KEY.

OpenAI SDK

Install the OpenAI client library.
Point the client at Poolside by setting the base URL and API key.
To use OpenRouter instead, set the base URL to https://openrouter.ai/api/v1 and pass your OPENROUTER_API_KEY.

OpenRouter SDK

Install the OpenRouter client library.
Create a client with your OPENROUTER_API_KEY.

Use the API for CLI automation

For CLI automation, set POOLSIDE_API_KEY before running pool exec. If you also set POOLSIDE_API_URL, use the Poolside deployment API URL from your administrator, not the /openai/v1 OpenAI-compatible API path. See Automate tasks.

Next steps