Skip to content

n8n

The n8n OpenAI node is designed primarily around official OpenAI credentials. When connecting to Tokeness, the HTTP Request node is more straightforward and easier to debug. Get it working with HTTP Request first, then decide whether to wrap it into a credential or sub-workflow depending on your n8n version.

Connection Details

FieldValue
MethodPOST
URLhttps://n.tokeness.dev/v1/chat/completions
AuthorizationBearer your Tokeness API key
Content-Typeapplication/json
ModelThe full model name from the Tokeness model catalog

1. Prepare Tokeness

Prepare the following first:

  1. A dedicated API key for n8n.
  2. A chat model name.
  3. Available balance.

Name the key something like:

txt
n8n-workflow

If you have multiple workflows in n8n, you can split keys by workflow.

2. Create an HTTP Request Node

Add an HTTP Request node to your n8n workflow.

Fill in:

txt
Method: POST
URL: https://n.tokeness.dev/v1/chat/completions

You can leave Authentication set to None for now and add the header manually. Once it works, switch to Bearer Auth or Header Auth credentials.

3. Configure Headers

Add two headers:

txt
Authorization: Bearer YOUR_TOKENESS_API_KEY
Content-Type: application/json

Do not put the real key directly into a workflow JSON that will be exported. For long-term use, store the key in n8n Credentials or an environment variable.

4. Configure the Body

Set the body type to JSON and fill in:

json
{
  "model": "YOUR_MODEL_NAME",
  "messages": [
    {
      "role": "user",
      "content": "Summarize in one sentence: {{$json.text}}"
    }
  ]
}

Replace YOUR_MODEL_NAME with the model name from the Tokeness model catalog.

If the upstream node does not have a text field, test with a fixed string first:

json
{
  "model": "YOUR_MODEL_NAME",
  "messages": [
    {
      "role": "user",
      "content": "Reply with ok only"
    }
  ]
}

5. Extract Text from the Response

The text returned by Chat Completions is typically at:

txt
choices[0].message.content

You can read this field in a subsequent Set, Code, or IF node.

If you use the Responses API, change the URL to:

txt
https://n.tokeness.dev/v1/responses

Example body:

json
{
  "model": "YOUR_MODEL_NAME",
  "input": "Reply with ok only"
}

The output structure of the Responses API differs from Chat Completions, so downstream nodes must read the actual returned fields.

6. Use Credentials

n8n HTTP Request credentials support Bearer Auth and Header Auth.

Bearer Auth:

txt
Bearer Token: your Tokeness API key

Header Auth:

txt
Name: Authorization
Value: Bearer your Tokeness API key

After creating the credential, select it in the HTTP Request node. This way the key is not exposed when the workflow is exported.

7. Workflow Tips

ScenarioRecommendation
Batch processingCreate a dedicated key for the workflow and set a quota
Long textSet a reasonable timeout and split the input if needed
RetriesLimit retry count to avoid burning balance in a failure loop
LoggingDo not log full request headers
ConcurrencyControl batch node concurrency to avoid sudden cost spikes

8. Troubleshooting

SymptomAction
401 UnauthorizedThe Authorization header should be Bearer KEY
404 Not FoundThe URL should be https://n.tokeness.dev/v1/chat/completions
model not foundRe-copy the model name from the Tokeness model catalog
JSON parse errorSet the body type to JSON and check quotes and commas
Expression is emptyTest with fixed text first, then connect upstream fields
No Tokeness logsThe request did not reach Tokeness — check the URL and whether the node executed
Workflow calls repeatedlyCheck loop nodes, retry settings, and error branches

External Documentation

OpenAI-compatible access with centralized models, quota, and logs.