Create a chat completion
curl --request POST \
--url https://api.feyn.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "your-workspace-model",
"messages": [
{
"role": "user",
"content": "hi"
}
]
}
'import requests
url = "https://api.feyn.ai/v1/chat/completions"
payload = {
"model": "your-workspace-model",
"messages": [
{
"role": "user",
"content": "hi"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'your-workspace-model', messages: [{role: 'user', content: 'hi'}]})
};
fetch('https://api.feyn.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}Models
Create a chat completion
OpenAI-compatible Chat Completions. Any field the OpenAI format accepts is passed through to the model.
POST
/
v1
/
chat
/
completions
Create a chat completion
curl --request POST \
--url https://api.feyn.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "your-workspace-model",
"messages": [
{
"role": "user",
"content": "hi"
}
]
}
'import requests
url = "https://api.feyn.ai/v1/chat/completions"
payload = {
"model": "your-workspace-model",
"messages": [
{
"role": "user",
"content": "hi"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'your-workspace-model', messages: [{role: 'user', content: 'hi'}]})
};
fetch('https://api.feyn.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error"
}
}Body
application/json
Response
A chat completion in the OpenAI format (or an event stream when stream is true).
The response is of type object.
⌘I