Connect Dify, LangChain and n8n to Tikway
For an OpenAI-compatible client with a custom base URL, use https://api.tikway.ai/v1, your Tikway API key and the complete model ID from the catalog. Follow the client-specific instructions and check that a text request reaches /v1/chat/completions.
Dify uses the OpenAI-API-compatible model provider. LangChain uses a custom base_url in ChatOpenAI. In n8n, configure the OpenAI credentials and OpenAI Chat Model node, then connect the model to AI Agent. Features depend on the client version and selected model; validate each step.
- Start with a minimal text request to verify the URL, key and model ID.
- Chat Completions and Responses are separate endpoints; select the one supported by the model and client.
- The agent application executes tools and returns their results to the model.
Choose agent models for tool calling and context
Agent inputs can include system prompts, tool definitions, conversation history and tool results. Check the endpoint, tool-calling capability, context window and output limit together. Similar model names still require separate checks of their complete IDs.
Read the supported protocols, endpoints and capabilities in the model catalog. Test one read-only tool, checking the tool name, arguments and returned result, before adding more tools or history. A successful plain-text request verifies only the basic connection.
- Tool calling: verify support in both the model and protocol.
- Context: include tool definitions and history in the input budget.
- Task quality: compare completion, retries and total cost using your own fixed tasks.
Verify the complete agent tool loop
A minimal loop sends tool definitions, reads the returned tool name and arguments, executes the tool in the application, returns its result with the matching call ID, and reads the final answer. The model API proposes a call; Dify, LangChain, n8n or your code performs it.
Begin with a harmless task such as reading sample data. Bound iterations, timeouts and retries, validate arguments, and record the failed step. MCP connections are configured in the application or framework; a model API URL alone does not establish an MCP connection.
- 401: check the Tikway key, Bearer authentication and client settings.
- 404: check duplicate /v1 segments and the chosen API endpoint.
- Missing tool execution: check model support, tool binding, arguments and result messages separately.
Estimate agent costs for the entire task
One agent task can make several model requests. Tool definitions, message history and tool results contribute to later inputs; retries and lengthy outputs also affect cost. Add each round of input, output and applicable extra charges, then assess whether the task completed.
Use the calculator to estimate the base text cost of one round, then sum actual multi-turn usage from request records. Check cache, image and external tool-service charges under their own rules.
- Set a maximum iteration count and an output limit per round.
- Record the model ID, response status, token usage and failure reason.
- Evaluate total task cost before expanding context or changing models.
Endpoints & protocol
| Setting | Value or verification step |
|---|---|
| OpenAI-compatible base URL | https://api.tikway.ai/v1 |
| Complete text endpoint | POST https://api.tikway.ai/v1/chat/completions |
| Authentication | Authorization: Bearer <your Tikway API key> |
| Model | Copy the complete model ID from the catalog and check endpoint and tool-calling support |
| Tool loop | Send tools, read tool_calls, execute tools in the app and return results with matching tool_call_id values |
Check prices before estimating a budget
Base text cost = input tokens × input rate + output tokens × output rate
Base catalog prices are in USD per token. Multiply by 1,000,000 to compare a per-million-token quote. The calculator estimates ordinary text input and output only. Check cache, image, video and other charges separately; account billing rules and request records determine the final charge.
Integration & troubleshooting resources
Frequently asked questions
Does Tikway provide an agent application or model APIs?
This page covers model API access for agent applications. Your framework or application manages prompts, tools, memory and execution. Tikway provides model endpoints, public model information and integration guides.
Does OpenAI compatibility guarantee every agent feature?
Features depend on the model, protocol, endpoint and client. Check tool-calling support and test a tool request plus its result message. Validate text, streaming, tool calling and Responses separately.
How can I check agent model IDs and costs?
Use the complete catalog ID, record model identifiers in requests and responses, and compare input/output token usage with account request records. These records help diagnose requests and costs; answer style alone does not prove the identity of an underlying model.