Create a chat completion
POST /projects/:projectid/chat/completions
Generate a response using an Intellectible model tier.
Authenticates a project API key, checks that it may use the requested tier, then routes small and medium to Intellectible's in-house model infrastructure or large to the external large-model provider.
Authentication
- Project API key: The credential for everything external. Created in Project Settings, bound to one project, and limited to the scopes it was granted. Format:
proj.<keyId>.<secret>. - Required permission:
llm.completeon :model.
Path parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
projectid | string | Yes | - | The project id. |
Request body
Content type: application/json
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | - | One of small, medium, or large. These are stable capability tiers rather than model IDs. |
messages | array | Yes | - | OpenAI-style chat messages. |
stream | boolean | No | false | Request a streamed response. |
Example
{
"model": "medium",
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"stream": true
}
Example request
curl -X POST \
-H "Authorization: proj.KEY_ID.SECRET" \
-H "Content-Type: application/json" \
-d '{"model":"medium","messages":[{"role":"user","content":"Hello"}],"stream":true}' \
{{BASE_URL}}/projects/{{PROJECT_ID}}/chat/completions
Responses
200
The completed OpenAI-style chat completion when stream is false.
{
"id": "chatcmpl_abc123",
"object": "chat.completion",
"model": "medium",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello!"
},
"finish_reason": "stop"
}
]
}
200 — stream
An SSE stream of OpenAI-style completion chunks followed by data: [DONE] when stream is true.
400
The tier is unknown or the request is malformed.
401
Missing, invalid, or disabled project API key.
403
The key is not permitted to use this tier.
502
The queue service, in-house worker, or external provider could not start, stream, or complete the request.