Before you start
Complete organization setup, make sure your account has inference credit, and create a key on the API Keys page. Most coding agents need a tool-capable chat model; Aider’s basic edit workflow does not require native tool calling. Image input and reasoning support depend on the model. These terminal examples use Bash or Zsh on macOS, Linux, or Windows through WSL. You need Python 3.10 or later and pip to run the SDK examples below. Install the package in the Python environment you use for your application.Get your connection settings
Open Integrations, select a model, then choose OpenAI Responses. The screen uses your organization’s region. The examples below use the public global endpoint; replace it with your regional endpoint and replaceYOUR_MODEL_ID with the full model ID shown there. Choose one of the models listed for this integration.
Set your Pearl API key in the terminal where you run OpenAI Responses:
Configure OpenAI Responses
Save the Python example aspearl_example.py in this directory.
Install
Stateless Responses
store=False and replay conversation history and returned output items. Stored-response continuation, previous_response_id, background execution, and WebSocket transport are not supported.
Run the saved example in the same terminal where you set your API key:
Set reasoning effort
The examples set the effort withreasoning={"effort": "high"}, where "none" turns thinking off. The response echoes the level the model applied in response.reasoning.effort.
Accepted levels are minimal, low, medium, high, xhigh, and max. The set a model actually serves is supported_efforts in its reasoning block on GET /models; any other level rounds up to the next served one, or to the highest past the top (how levels map). Omit the field for the model’s default, which is max on GLM-5.3, so set it explicitly for agents and pipelines. GLM-5.3 and GLM-5.3-Flash always reason and return 400 on the off switch. The output token limit covers the reasoning and the answer.
Stream a reply
Save this example aspearl_stream.py to print text as it arrives:
Start using OpenAI Responses
Replace the example prompt with your own request. You can review token usage and costs on the Analytics page.Troubleshooting
401: check the key and allow time for a newly created key to reach the inference gateway.404: copy the endpoint and exact model ID from Integrations. OpenAI base URLs end in/v1; the Anthropic SDK and Claude Code use the URL without that suffix.402: check your organization’s credit and billing status.429or Anthropic529: respect retry instructions and reduce concurrency.- For truncated output, check the output limit and reasoning budget. Increase limits only within the model’s maximum output length.
- If pip is missing or reports
externally-managed-environment, follow the Python package installation guide for your Python installation, then use that same interpreter to install the SDK and run the example.