Developers / Documentation
TryLLM API reference
Connect your editor or OpenAI SDK to TryLLM. Use your API key, the base URL below, and an exact model ID from the catalog.
API base URL
https://trychat.net/api/public/llm/v1Quickstart
Three steps from sign-up to your first completion.
- 01
Create a key
Sign in, open the dashboard and create a key. It's shown in full once.
- 02
Point at the base URL
Swap OpenAI's base URL for the TryLLM endpoint in your tool or SDK.
- 03
Send a request
Use any OpenAI-shaped request. Streaming works the same way.
curl https://trychat.net/api/public/llm/v1/chat/completions \
-H "Authorization: Bearer $TRYLLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tryllm-chat",
"messages": [{ "role": "user", "content": "Explain recursion in one line." }]
}'Authentication
Every request carries your key as a bearer token, exactly like OpenAI.
Base URL
https://trychat.net/api/public/llm/v1Header
Authorization: Bearer sk-llm_…Keys start with sk-llm_. Create and revoke them in your dashboard. A key is shown in full only once — store it in an environment variable, never in client-side code or a public repository.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /chat/completions | Chat completion, streaming or not. Same body as OpenAI. |
GET | /models | List available model IDs. Requires your API key. |
Code examples
The official OpenAI SDKs work unchanged.
from openai import OpenAI
client = OpenAI(
api_key="sk-llm_your_key",
base_url="https://trychat.net/api/public/llm/v1",
)
response = client.chat.completions.create(
model="tryllm-chat",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)Streaming
Set stream: true and read server-sent chunks, exactly as with OpenAI.
const stream = await client.chat.completions.create({
model: "tryllm-chat",
messages: [{ role: "user", content: "Write a haiku about yellow." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Model catalog
Copy the exact model ID into your editor's custom model field or the model parameter in your request. Names are for display; IDs are what the API accepts.
0 available models
Loading model catalog…
curl https://trychat.net/api/public/llm/v1/models \ -H "Authorization: Bearer $TRYLLM_API_KEY"
Editors & apps
Two settings in each tool: the base URL and your key.
- 1Settings → Models → OpenAI API Key.
- 2Turn on "Override OpenAI Base URL" and paste https://trychat.net/api/public/llm/v1.
- 3Paste your sk-llm_ key, add tryllm-chat or tryllm-reasoner as a custom model, then verify.
Errors
Errors use the OpenAI error object, so existing error handling keeps working.
| Status | Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | The key is wrong, revoked or missing. |
| 402 | insufficient_credit | Allowance used up and no credit left on the account. |
| 404 | model_not_found | That model id does not exist. |
| 429 | rate_limit_exceeded | Too many requests. Back off and retry, or upgrade. |
| 500 | server_error | Something failed on our side. Retry. |
{
"error": {
"message": "Invalid API key.",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}Billing
Requests draw on your monthly allowance first, then on prepaid credit.
Usage is metered per token and shown per model in your dashboard. When the allowance runs out and no credit remains, requests fail with 402 insufficient_credit until you top up.
