Tax NigeriaTax Nigeria Docs
    Tax NigeriaTax Nigeria Docs
    Tax AssistantAPI ReferenceIntroductionQuickstartAuthenticationEmbeddable AI WidgetNigerian Tax Laws & 2026 ReformsErrors & Rate Limits

    Partner API

    Partner API OverviewUnified Tax CalculatorPAYE CalculatorCompany Income Tax (CIT)Withholding Tax (WHT)Penalties & InterestStatutory DeadlinesAI Tax Law QueryTax Gazette SearchAI Chat Completions
    API Reference

    AI Chat Completions

    OpenAI-compatible endpoint for streaming and conversational tax intelligence.

    AI Chat Completions

    POST /api/v1/chat/completions

    An OpenAI-compatible chat completions endpoint that leverages the full Tax Nigeria cognitive architecture, including grounding against Nigerian tax legislation, context-aware memory, and multilingual conversational capability.

    You can drop the Tax Nigeria API directly into the official OpenAI SDK, LangChain, or Vercel AI SDK by pointing the baseURL to https://taxnigeria.ng/api/v1.

    Required scope: tax:chat.


    Request Parameters

    ParameterTypeRequiredDefaultDescription
    messagesarrayYes—Array of conversation message objects: [{ role: "user", content: "..." }].
    modelstringNo"gpt-4o-mini"Model identifier.
    streambooleanNofalseWhether to stream back partial chunks as server-sent events (SSE).
    modestringNo"ai_tax_queries"AI persona mode ("ai_tax_queries", "general", "education").
    languagestringNo"English"Language response preference ("English", "Pidgin", "Yoruba", "Hausa", "Igbo").
    conversation_idstringNo—Optional conversation ID to persist dialog turns to your Tax Nigeria workspace.

    Code Examples

    import OpenAI from "openai";
    
    const client = new OpenAI({
      apiKey: process.env.TAX_NIGERIA_API_KEY,
      baseURL: "https://taxnigeria.ng/api/v1",
    });
    
    const response = await client.chat.completions.create({
      model: "gpt-4o-mini",
      messages: [
        { role: "user", content: "What is the penalty for failing to remit PAYE tax to LIRS on time in Lagos State?" }
      ],
    });
    
    console.log(response.choices[0].message.content);

    Response Example (200 OK)

    {
      "id": "chatcmpl_98f12a3d4e5b",
      "object": "chat.completion",
      "created": 1719576400,
      "model": "gpt-4o-mini",
      "choices": [
        {
          "index": 0,
          "message": {
            "role": "assistant",
            "content": "Under the Personal Income Tax Act (PITA) Section 33, Consolidated Relief Allowance (CRA) is a statutory tax relief deducted from an individual's gross earned income before taxable income is computed. It is calculated as the higher of ₦200,000 or 1% of gross income, plus 20% of gross income. This significantly reduces the taxable base for all income earners across Nigeria."
          },
          "finish_reason": "stop"
        }
      ],
      "usage": {
        "prompt_tokens": 142,
        "completion_tokens": 88,
        "total_tokens": 230
      },
      "sources": [
        {
          "title": "Personal Income Tax Act (PITA) Cap P8 LFN 2004",
          "section": "Section 33 - Consolidated Relief Allowance"
        }
      ]
    }

    Tax Gazette Search

    Semantic vector search across official Nigerian tax legislation, gazettes, and court circulars.

    On this page

    AI Chat CompletionsRequest ParametersCode ExamplesResponse Example (200 OK)