Use LangChain with the Straitly API
Use LangChain with Straitly in 5 steps: install langchain-openai, set the base URL to https://api.straitly.ai/v1 and pass your Straitly key. Claude Sonnet 5.5 then costs $1.20 in and $6.00 out per 1M tokens, 40% under its list price of $2.00 and $10.00.[1][3]
Updated
- Setting
- Client constructor
- Base URL
- https://
api.straitly.ai/ v1 - API key
- sk-YOUR_KEY
- API format
- OpenAI-compatible
- Connect with
- Python client
Your prompts, files and workflow stay as they are. From LangChain's docs, checked 16 November 2026[1]
LangChain in 5 steps.
Replace sk-YOUR_KEY with your own key from the Keys page. Setting lives in Client constructor, base URL https://api.straitly.ai/v1.
Step 1: Get a Straitly key
Sign up with email or Google, add credits from $5 (no subscription, no minimum), then create a key on the Keys page. It starts with sk-. Keep it private.
Step 2: Install the library
Install LangChain in your project.
Terminal
python -m pip install langchain-openaiStep 3: Set your key
Keep the key in an environment variable on the server that runs your code, never in browser code.
Terminal · Mac / Linux
export STRAITLY_API_KEY="YOUR_STRAITLY_API_KEY"Step 4: Point the client at Straitly
use_responses_api=False keeps this example on Chat Completions. Provider-specific extras and hosted tools are not implied by OpenAI compatibility.
Python · example.py
import os from langchain_openai import ChatOpenAI llm = ChatOpenAI( model="claude-sonnet-5-5", base_url="https://api.straitly.ai/v1", api_key=os.environ["STRAITLY_API_KEY"], use_responses_api=False, ) response = llm.invoke([("human", "Say hello in one sentence.")]) print(response.content)Step 5: Run it
Run the file. It prints one sentence from the model. Change the model ID to switch models.
Terminal
python example.py
Checked against LangChain's own docs, 16 November 2026
- LangChain reference[1] (docs.langchain.com)
Config names and menu paths match these pages as of the date shown. If LangChain changes them, its docs win.
What happens to a LangChain request?
Two settings change in LangChain: where requests go and which key pays for them. Everything else, from your prompts to your workflow, stays as it is.
LangChain, as it is
Your prompts, files and workflow stay as they are. The request leaves in the same format as before.
One address, one key
It goes to
https://api.straitly.ai/v1with your Straitly key. That is the whole setup.[1]The same models
The key reaches 117 models. You ask for each one by its model ID.[4]
A smaller bill
Claude Sonnet 5.5 for 10M input tokens and 1M output tokens costs $18.00 against $30.00 at list.[3]
LangChain on Straitly in numbers
- 5
- Steps to connect LangChain[1]
- 40%
- Straitly under the provider's list price, on most models[2]
- $18.00
- Claude Sonnet 5.5 for 10M input tokens and 1M output tokens, against $30.00 at list[3]
- 117
- Models one key reaches from LangChain[4]
- $5
- Smallest top-up. No subscription and no minimum[4]
- $0
- Charged for failed requests[2]
- 98 of 103
- Models with a list price that are at least 40% under it[3]
- 134 of 145
- Models priced under the lowest OpenRouter seller[3]
LangChain questions.
Ask a question- Yes. Pass https://api.straitly.ai/v1 as the base URL and your Straitly key as the API key. Keep /v1 at the end.
- Any of the 117 models on the models page. The example uses claude-sonnet-5-5.
- On 2026-11-25 Straitly charged $1.20 input and $6.00 output per 1M tokens for Claude Sonnet 5.5, against a list price of $2.00 and $10.00: 40% under list on input and output alike.
- No. Credits are prepaid, failed requests cost nothing, and there is no subscription, minimum or fee to add credits.
Sources
Setup steps follow LangChain's own documentation, read on the date shown. Prices come from Straitly's public catalog.
What each source says
- [1] LangChain reference
- The library's own reference for the client used in this example.
- [2] Straitly pricing
- Billed per token at the pooled rate, 40% under the provider's published rate on most models, with nothing added on top. Failed requests cost nothing. No subscription, no minimum.
- [3] Straitly public catalog
- Every model ID with Straitly's price, the lab's official list price where one is published, and the lowest OpenRouter seller including its 5.5% credit fee.
- [4] Straitly home page
- One OpenAI-compatible API for 117 models. Sign up with email or Google, top-ups from $5 with no card or platform fee, base URL https://api.straitly.ai/v1, and requests move to another provider serving the same model if one goes down.
Which other tools use the same key?
- Claude CodeAnthropic Messages. Env vars or settings.json.
- CursorOpenAI-compatible. Settings, no script.
- CodexOpenAI Responses. config.toml provider.
- OpenCodeOpenAI-compatible. opencode.json provider.
- ClineOpenAI-compatible. Settings, no script.
- Claude appAnthropic Messages. Developer menu gateway.
- HermesOpenAI-compatible. Custom endpoint.
- OpenClawOpenAI-compatible. Custom provider.
- OpenAI SDKOpenAI-compatible. Python client.
- Anthropic SDKAnthropic Messages. Python client.
- LlamaIndexOpenAI-compatible. Python client.
- Vercel AI SDKOpenAI-compatible. TypeScript client.
Start with one request.
Prepaid, no subscription, no minimum. 40% under list on most models you reach from LangChain.